pandas - Read Quandl API errors in Python -


i still relatively new python, , trying read/catch/handle errors when using quandl api.

for example, if type in dataset not exist, "read" error returned call, newbie python, not sure how read errors. api document quandl api shows http errors , quandl errors able handle.

here simple code sample fails, , trying read/catch/handle error.

import pandas pd import quandl q  df = q.get("cme/plz2016") 

the traceback gives lots of details error , has section @ end:

during handling of above exception, exception occurred:

traceback (most recent call last):      file "d:\pyproj\quandl\workingsamplequandldownload.py", line 7, in <module>        df = q.get(exchsymbol, trim_start=strstartdate)     file "d:\python33\lib\quandl\quandl.py", line 124, in       raise datasetnotfound(error)   quandl.quandl.datasetnotfound: dataset not found. check quandl code: cme/plz2016 errors 

if use try/exception, get: dataset not found. check quandl code: cme/plz2016 errors

so, ask assistance in teaching me how read/catch/handle above error quandl. can learn how find out quandl error , http status.

thanks in advance.

you need import notfounderror quandl:

import pandas pd import quandl q quandl.errors.quandl_error import notfounderror   try:   df = q.get("cme/plz2016") except notfounderror:   print(nameerror) 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -