Skip to content

Commit

Permalink
BRAND-40/switch-quandl-url-to-data-link: Switched URL to match rebrand (
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvautour-quandl authored Nov 1, 2021
1 parent 7e9519c commit ce235a1
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 34 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 3.6.2 - 2021-11-01

* Switch base URL from www.quandl.com to data.nasdaq.com

### 3.6.1 - 2021-03-03

* Add documentation/tests for supporting Point In Time datetime values
Expand Down Expand Up @@ -25,7 +29,7 @@

* This version is the last `quandl` version to support Python 2 or < 3.5. All future `quandl` package releases will only support Python >= 3.5.

If you're still using Python 2 or < 3.5, you'll need to stay at this version.
If you're still using Python 2 or < 3.5, you'll need to stay at this version.

If you're using Python >= 3.5, its recommended you perform a `pip install --upgrade quandl` to grab the newest
version.
Expand Down
2 changes: 1 addition & 1 deletion quandl/api_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class ApiConfig:
api_key = None
api_protocol = 'https://'
api_base = '{}www.quandl.com/api/v3'.format(api_protocol)
api_base = '{}data.nasdaq.com/api/v3'.format(api_protocol)
api_version = None # This is not used but keeping for backwards compatibility
page_limit = 100

Expand Down
2 changes: 1 addition & 1 deletion quandl/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '3.6.1'
VERSION = '3.6.2'
10 changes: 5 additions & 5 deletions test/helpers/merged_datasets_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,23 @@ def setupDatasetsTest(unit_test, httpretty):

httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datasets/.*/metadata'),
'https://data.nasdaq.com/api/v3/datasets/.*/metadata'),
responses=[httpretty.Response(body=json.dumps(dataset))
for dataset in
[unit_test.nse_oil, unit_test.wiki_aapl,
unit_test.wiki_msft]])
# mock our query param column_index request
httpretty.register_uri(httpretty.GET,
"https://www.quandl.com/api/v3/datasets/SINGLE/COLUMN/data",
"https://data.nasdaq.com/api/v3/datasets/SINGLE/COLUMN/data",
body=json.dumps(unit_test.single_dataset_data))
httpretty.register_uri(httpretty.GET,
"https://www.quandl.com/api/v3/datasets/WIKI/AAPL/data",
"https://data.nasdaq.com/api/v3/datasets/WIKI/AAPL/data",
body=json.dumps(unit_test.dataset_data))
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datasets/NSE/OIL/data'),
'https://data.nasdaq.com/api/v3/datasets/NSE/OIL/data'),
body=json.dumps(unit_test.dataset_data))
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datasets/WIKI/MSFT/data'),
'https://data.nasdaq.com/api/v3/datasets/WIKI/MSFT/data'),
body=json.dumps(unit_test.dataset_data))
8 changes: 4 additions & 4 deletions test/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_quandl_exceptions_no_retries(self, request_method):
('QEZx02', 400, QuandlError)]

httpretty.register_uri(getattr(httpretty, request_method),
"https://www.quandl.com/api/v3/databases",
"https://data.nasdaq.com/api/v3/databases",
responses=[httpretty.Response(body=json.dumps(
{'quandl_error':
{'code': x[0], 'message': 'something went wrong'}}),
Expand All @@ -48,7 +48,7 @@ def test_quandl_exceptions_no_retries(self, request_method):
def test_parse_error(self, request_method):
ApiConfig.retry_backoff_factor = 0
httpretty.register_uri(getattr(httpretty, request_method),
"https://www.quandl.com/api/v3/databases",
"https://data.nasdaq.com/api/v3/databases",
body="not json", status=500)
self.assertRaises(
QuandlError, lambda: Connection.request(request_method, 'databases'))
Expand All @@ -57,7 +57,7 @@ def test_parse_error(self, request_method):
def test_non_quandl_error(self, request_method):
ApiConfig.retry_backoff_factor = 0
httpretty.register_uri(getattr(httpretty, request_method),
"https://www.quandl.com/api/v3/databases",
"https://data.nasdaq.com/api/v3/databases",
body=json.dumps(
{'foobar':
{'code': 'blah', 'message': 'something went wrong'}}), status=500)
Expand All @@ -72,7 +72,7 @@ def test_build_request(self, request_method, mock):
params = {'per_page': 10, 'page': 2}
headers = {'x-custom-header': 'header value'}
Connection.request(request_method, 'databases', headers=headers, params=params)
expected = call(request_method, 'https://www.quandl.com/api/v3/databases',
expected = call(request_method, 'https://data.nasdaq.com/api/v3/databases',
headers={'x-custom-header': 'header value',
'x-api-token': 'api_token',
'accept': ('application/json, '
Expand Down
4 changes: 2 additions & 2 deletions test/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def setUpClass(cls):
dataset_data = {'dataset_data': DatasetDataFactory.build()}
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datasets*'),
'https://data.nasdaq.com/api/v3/datasets*'),
body=json.dumps(dataset_data))
cls.expected_raw_data = [{'date': datetime.date(2015, 7, 11), 'column1': 444.3,
'column2': 10, 'column3': 3},
Expand Down Expand Up @@ -150,6 +150,6 @@ def test_exception_raised_if_column_and_data_row_mistmatch(self):
'dataset_data': DatasetDataFactory.build(column_names=['blah'])}
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datasets*'),
'https://data.nasdaq.com/api/v3/datasets*'),
body=json.dumps(dataset_data))
self.assertRaises(InvalidDataError, lambda: Data.all())
10 changes: 5 additions & 5 deletions test/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def setUpClass(cls):
database = {'database': DatabaseFactory.build(database_code='NSE')}
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/databases/*'),
'https://data.nasdaq.com/api/v3/databases/*'),
body=json.dumps(database))
cls.db_instance = Database(Database.get_code_from_meta(
database['database']), database['database'])
Expand Down Expand Up @@ -71,7 +71,7 @@ def setUpClass(cls):
databases.update(meta)
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/databases*'),
'https://data.nasdaq.com/api/v3/databases*'),
body=json.dumps(databases))
cls.expected_databases = databases

Expand Down Expand Up @@ -113,7 +113,7 @@ def setUp(self):
httpretty.enable()
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/databases/*'),
'https://data.nasdaq.com/api/v3/databases/*'),
adding_headers={
'Location': 'https://www.blah.com/download/db.zip'
},
Expand All @@ -134,7 +134,7 @@ def test_get_bulk_downnload_url_with_download_type(self):
url = self.database.bulk_download_url(params={'download_type': 'partial'})
parsed_url = urlparse(url)
self.assertEqual(parsed_url.scheme, 'https')
self.assertEqual(parsed_url.netloc, 'www.quandl.com')
self.assertEqual(parsed_url.netloc, 'data.nasdaq.com')
self.assertEqual(parsed_url.path, '/api/v3/databases/NSE/data')
self.assertDictEqual(parse_qs(parsed_url.query), {
'download_type': ['partial'],
Expand Down Expand Up @@ -177,7 +177,7 @@ def test_bulk_download_raises_exception_when_error_response(self):
httpretty.reset()
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/databases/*'),
'https://data.nasdaq.com/api/v3/databases/*'),
body=json.dumps(
{'quandl_error':
{'code': 'QEMx01', 'message': 'something went wrong'}}),
Expand Down
4 changes: 2 additions & 2 deletions test/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def setUpClass(cls):
database_code='NSE', dataset_code='OIL')}
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datasets/*'),
'https://data.nasdaq.com/api/v3/datasets/*'),
body=json.dumps(dataset))
dataset_code = Dataset.get_code_from_meta(dataset['dataset'])
cls.dataset_instance = Dataset(dataset_code, dataset['dataset'])
Expand Down Expand Up @@ -76,7 +76,7 @@ def setUpClass(cls):
datasets.update(meta)
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datasets*'),
'https://data.nasdaq.com/api/v3/datasets*'),
body=json.dumps(datasets))

@classmethod
Expand Down
10 changes: 5 additions & 5 deletions test/test_datatable.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def setUpClass(cls):
vendor_code='ZACKS', datatable_code='FC')}
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datatables/*'),
'https://data.nasdaq.com/api/v3/datatables/*'),
body=json.dumps(datatable))
cls.datatable_instance = Datatable(datatable['datatable'])

Expand Down Expand Up @@ -118,12 +118,12 @@ def setUpClass(cls):
vendor_code='AUSBS', datatable_code='D')}
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datatables/*'),
'https://data.nasdaq.com/api/v3/datatables/*'),
body=json.dumps(datatable))

httpretty.register_uri(httpretty.POST,
re.compile(
'https://www.quandl.com/api/v3/datatables/*'),
'https://data.nasdaq.com/api/v3/datatables/*'),
body=json.dumps(datatable))
cls.datatable_instance = Datatable(datatable['datatable'])

Expand Down Expand Up @@ -154,7 +154,7 @@ def test_download_generated_file(self, request_method):

httpretty.register_uri(getattr(httpretty, request_method),
re.compile(
'https://www.quandl.com/api/v3/datatables/*'),
'https://data.nasdaq.com/api/v3/datatables/*'),
body=json.dumps({
'datatable_bulk_download': {
'file': {
Expand Down Expand Up @@ -190,7 +190,7 @@ def test_bulk_download_table_raises_exception_when_error_response(self, request_

httpretty.register_uri(getattr(httpretty, request_method),
re.compile(
'https://www.quandl.com/api/v3/datatables/*'),
'https://data.nasdaq.com/api/v3/datatables/*'),
responses=error_responses)

self.assertRaises(
Expand Down
4 changes: 2 additions & 2 deletions test/test_datatable_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ def setUpClass(cls):
datatable_data.update(meta)
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datatables/*'),
'https://data.nasdaq.com/api/v3/datatables/*'),
body=json.dumps(datatable_data))

httpretty.register_uri(httpretty.POST,
re.compile(
'https://www.quandl.com/api/v3/datatables/*'),
'https://data.nasdaq.com/api/v3/datatables/*'),
body=json.dumps(datatable_data))
cls.expected_raw_data = []
cls.expected_list_values = []
Expand Down
2 changes: 1 addition & 1 deletion test/test_get_point_in_time_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GetPointInTimeTest(unittest.TestCase):
def setUpClass(cls):
httpretty.enable()
httpretty.register_uri(httpretty.GET,
re.compile('https://www.quandl.com/api/v3/pit*'),
re.compile('https://data.nasdaq.com/api/v3/pit*'),
body=json.dumps({}))

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion test/test_get_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def setUpClass(cls):
datatable.update(meta)
httpretty.register_uri(httpretty.GET,
re.compile(
'https://www.quandl.com/api/v3/datatables*'),
'https://data.nasdaq.com/api/v3/datatables*'),
body=json.dumps(datatable))
cls.datatable_instance = Datatable(datatable['datatable'])

Expand Down
2 changes: 1 addition & 1 deletion test/test_point_in_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class GetPointInTimeTest(ModifyRetrySettingsTestCase):
def setUpClass(cls):
httpretty.enable()
httpretty.register_uri(httpretty.GET,
re.compile('https://www.quandl.com/api/v3/pit/*'),
re.compile('https://data.nasdaq.com/api/v3/pit/*'),
body=json.dumps({}))

@classmethod
Expand Down
6 changes: 3 additions & 3 deletions test/test_retries.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_correct_response_returned_if_retries_succeed(self):

mock_responses = [self.error_response] + [self.error_response] + [self.success_response]
httpretty.register_uri(httpretty.GET,
"https://www.quandl.com/api/v3/databases",
"https://data.nasdaq.com/api/v3/databases",
responses=mock_responses)

response = Connection.request('get', 'databases')
Expand All @@ -96,7 +96,7 @@ def test_correct_response_exception_raised_if_retries_fail(self):
ApiConfig.retry_status_codes = [self.error_response.status]
mock_responses = [self.error_response] * 3
httpretty.register_uri(httpretty.GET,
"https://www.quandl.com/api/v3/databases",
"https://data.nasdaq.com/api/v3/databases",
responses=mock_responses)

self.assertRaises(InternalServerError, Connection.request, 'get', 'databases')
Expand All @@ -106,7 +106,7 @@ def test_correct_response_exception_raised_for_errors_not_in_retry_status_codes(
ApiConfig.retry_status_codes = []
mock_responses = [self.error_response]
httpretty.register_uri(httpretty.GET,
"https://www.quandl.com/api/v3/databases",
"https://data.nasdaq.com/api/v3/databases",
responses=mock_responses)

self.assertRaises(InternalServerError, Connection.request, 'get', 'databases')

0 comments on commit ce235a1

Please sign in to comment.