Python Forum
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Quandl and Python3
#1
I tried to run the following code that uses the python module for Quandl. This came right out of a textbook on machine learning.

I did not use an authentication token because the sample code did not.

Anyway it generated an error. As shown.

But it was exactly from the textbook.

See the output shown below.


python3 
Python 3.5.2 (default, Nov 12 2018, 13:43:14) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import quandl
>>> mydata = quandl.get("YAHOO/INDEX_DJI", start_date="2005-12-01",end_date="2005-12-05")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/james/.local/lib/python3.5/site-packages/quandl/get.py", line 48, in get
    data = Dataset(dataset_args['code']).data(params=kwargs, handle_column_not_found=True)
  File "/home/james/.local/lib/python3.5/site-packages/quandl/model/dataset.py", line 47, in data
    return Data.all(**updated_options)
  File "/home/james/.local/lib/python3.5/site-packages/quandl/operations/list.py", line 15, in all
    r = Connection.request('get', path, **options)
  File "/home/james/.local/lib/python3.5/site-packages/quandl/connection.py", line 38, in request
    return cls.execute_request(http_verb, abs_url, **options)
  File "/home/james/.local/lib/python3.5/site-packages/quandl/connection.py", line 42, in execute_request
    session = cls.get_session()
  File "/home/james/.local/lib/python3.5/site-packages/quandl/connection.py", line 58, in get_session
    adapter = HTTPAdapter(max_retries=cls.get_retries())
  File "/home/james/.local/lib/python3.5/site-packages/quandl/connection.py", line 74, in get_retries
    raise_on_status=False)
TypeError: __init__() got an unexpected keyword argument 'raise_on_status'
How do I fix this error? Remember it came from a textbook.

Any help appreciated. Thanks.

Respectfully,

ErnstTBass



















[/code]
Reply
#2
Okay, I think that I know what the error is. It is looking to get the Quandl Authorization token and it is not finding it.

It needs something like

quandl.ApiConfig.api_key = "YOURAPIKEY" (with of course the YOURAPIKEY replaced by quandl authorization token)

to be inserted in the next line after import quandl line

However, even when I do this I still get the error.

I am beginning to believe that the auth token has a limited lifetime and I did not
use it quickly enough.

My auth token is 20 characters long and it includes numbers and letters (some small and some capital).

How do get this thing to work?

Respectfully,

ErnestTBass
Reply
#3
A simple script:

#!/usr/bin/python3
import requests
key = "xxxxxxxxx" # key is free
  
tic = "euronext/ibma"
url = "https://www.quandl.com/api/v3/datasets/"+tic+"?rows=1&api_key="+key
 
rsp = requests.get(url)
if rsp.status_code in (200,):
    ustr = rsp.text.strip()
    print(ustr)
else:
    print("ERROR:", rsp.status_code)
    print(rsp.text)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 4,915 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  [split] Using Quandl and Python3 ratayr 1 1,866 May-27-2019, 12:26 PM
Last Post: DeaD_EyE
  Use quandl to conect TSE ian 1 3,113 Jul-05-2017, 08:44 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020