-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTPError: HTTP Error 400: Bad Request #25
Comments
Per their terms of use: Limitations The Federal Reserve Bank of St. Louis may impose limits on certain features and services or restrict your access to parts or all of the FRED® API or the Federal Reserve Bank of St. Louis web site or web services without notice or liability. You acknowledge and agree that the Federal Reserve Bank of St. Louis may impose or adjust the limit on the amount of bandwidth you may use or the number of transactions you may send or receive through the FRED® API; such fixed upper limits may be set by the Federal Reserve Bank of St. Louis at any time, at the Federal Reserve Bank of St. Louis’s discretion. So I believe they're probably rate-limiting your API key, but they don't disclose the exact limits. 429 Too Many Requests is the typical response for such rate limiting. You say it won't fix even if you use sleep... how much are you sleeping? Sleep for multiple minutes, or cut your initial rate down sufficiently, and it should be fine. |
I tried: time sleep(0.01), time sleep(0.05), time sleep(1) respectively. I appreciate your response very much. I either need to limit the number of series per request or check with Fred if rate limits can be increased. Thanks, |
HTTPError Traceback (most recent call last) c:\users\mindy\appdata\local\programs\python\python37-32\lib\urllib\request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context) c:\users\mindy\appdata\local\programs\python\python37-32\lib\urllib\request.py in open(self, fullurl, data, timeout) c:\users\mindy\appdata\local\programs\python\python37-32\lib\urllib\request.py in http_response(self, request, response) c:\users\mindy\appdata\local\programs\python\python37-32\lib\urllib\request.py in error(self, proto, *args) c:\users\mindy\appdata\local\programs\python\python37-32\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args) c:\users\mindy\appdata\local\programs\python\python37-32\lib\urllib\request.py in http_error_default(self, req, fp, code, msg, hdrs) HTTPError: HTTP Error 400: Bad Request During handling of the above exception, another exception occurred: ValueError Traceback (most recent call last) c:\users\mindy\appdata\local\programs\python\python37-32\lib\site-packages\fredapi\fred.py in get_series(self, series_id, observation_start, observation_end, **kwargs) c:\users\mindy\appdata\local\programs\python\python37-32\lib\site-packages\fredapi\fred.py in __fetch_data(self, url) ValueError: None |
I put 600+ series_id in a text file and let Python loop through it.
There occurred error 'HTTPError: HTTP Error 400: Bad Request' & 'HTTPError: HTTP Error 429: Too Many Requests'
It won't fix even I use sleep.
Then I tested with 100 series. It ran fine without any error.
I also tested Excel Add-in provided by Fred. The maximum # of download is up to column GR, that's 174.
However API can't download 174 series without error message.
Can I ask what's is the maximum of series API can retrieve per connection request?
Is there a way to download 1000+ series without error?
Thanks,
Mindy
The text was updated successfully, but these errors were encountered: