Forums

problem fetching data from Quandl

Quandl is available as part of PythonAnywhere's "batteries included" packages. However, trying to fetch data from it threw an error:

URLError: < urlopen error [Errno 111] Connection refused >

It seems to work for me (from a free account):

>>> import Quandl
>>> print(Quandl.get('FRED/GDP'))
              VALUE
DATE               
1947-01-01    243.1
1947-04-01    246.3
1947-07-01    250.1

What code are you running?

Harry, thanks for the reply.

Okay, I tested with the Python console this time, and it worked.. but it still doesn't work from an iPython notebook (which is what I was trying to use).

Any idea why that would be?

Hm. It works for me from an IPython notebook. Out of curiosity, can you try this?

import os
print(os.environ.get('http_proxy'))

Returns None for me.

The only thing I can think of is that, somehow, the firewall settings didn't get through to the machine your notebook is running on...

If that's so, then it's probably not just quandl that's broken, it's probably all Internet access. What happens if you do a

import requests
print(requests.get('http://www.yahoo.com'))

If we get connection refused again, that makes the firewall theory seem likely.

So then try this -- if you go to your consoles page, click "fetch process list", and then kill all the notebook/jupyterhub/sudospawner processes, and then try accessing your notebook again? That should cause the sandbox to get re-created, and the firewall rules to be updated...

It throws an error when I try to run the code you suggested:

ConnectionError: HTTPConnectionPool(host='www.yahoo.com', port=80): Max retries exceeded with url: / (Caused by <class 'OSError'>: [Errno 101] Network is unreachable)

I killed the processes but it didn't make any difference - I get exactly the same behaviour.

OK, try it again now?

It's working now... thank you!

Hi - new user here. Having the same problem, even after killing processes. proxy test prints None, yahoo is also refused. were there further steps to take? thanks.

Try again now?

works! anything I need to do for future reference?

No, just ask us if you see anything weird again, and we'll try and figure out why it went wrong...

Hi,

I am not accessing data from Quandl, but just trying to download some data (specifically

:::python import urllib.request urllib.request.urlretrieve('http://www.ssa.gov/oact/babynames/names.zip', 'names.zip')

to try to reproduce an example from Wes McKinney's book.

I get the [Errno 101] Network is unreachable> message.

Just tried :::python import requests print(requests.get('http://www.yahoo.com'))

and got same message. This is a recently created 'Hacker' account - I believe I should be able to access this data ?

Hi there,

You will have to start new consoles after upgrading. Were you using an old console? Or are you using jupyter notebooks?

hi,

above is in a jupyter notebook. I tried 'kill' of all process and restart of notebook. Same result.

Should I expect to be able to open such a url from a notebook ?

It looks like we have a bug somewhere that sometimes means that an upgraded account doesn't get the new network configuration. We'll investigate and fix that. I've fixed your account so you should be able to access those URLs now.

Thanks,

confirmed it is working fine for me now.

Hi, I am having the same problems with jupyter notebooks.

I cannot do a simple requests.get. I get the "[Errno 101] Network is unreachable"

Thanks

Could you try again now? We just did a system update, which should have the same effect as the fix that I did for @epeesharkey previously.

Now it works fine.

Thanks giles

Excellent, thanks for confirming!