Skip to content
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

Max retries exceeded #3

Open
senn117 opened this issue Apr 6, 2023 · 9 comments
Open

Max retries exceeded #3

senn117 opened this issue Apr 6, 2023 · 9 comments

Comments

@senn117
Copy link

senn117 commented Apr 6, 2023

When I call comtradeapicall.getFinalData, I will get HTTPSConnectionPool(host='comtradeapi.un.org', port=443): Max retries exceeded with url error. Is there any limitation of getFinalData?

@uncomtrade
Copy link
Owner

uncomtrade commented Apr 6, 2023 via email

@senn117
Copy link
Author

senn117 commented Apr 7, 2023

Gotcha,

Thanks!

@najuzilu
Copy link

Following up on this to clarify whether I understand the new API restrictions correctly.

When making the following query (see below), I would expect to receive a dataframe with at most 97 rows because there are at most 97 2-digit HS codes in a specific year. However, I get Error code: 429 Error message: Rate limit is exceeded. Try again in 2 seconds. If the restriction is that we get a max of 500 entries/rows per query and we're still limited to 100 queries/hour with the free tier, then @uncomtrade help me understand why I keep running into this rate limit exceeded error. I have not exceeded my 100 queries/hour limit.

mydf = comtrade.previewFinalData(
  typeCode='C', 
  freqCode='A', 
  clCode='HS', 
  period='2002',
  reporterCode='842',  #USA
  cmdCode='AG2',
  flowCode='M', 
  partnerCode='156', #China
  partner2Code=None,
  customsCode=None, 
  motCode=None, 
  maxRecords=500, 
  format_output='JSON',
  aggregateBy=None, 
  breakdownMode='classic', 
  countOnly=None, 
  includeDesc=True
)

@senn117
Copy link
Author

senn117 commented May 19, 2023

I guess the service is currently undergoing maintenance. I have conducted some tests, and the requests that used to work fine are now giving the same error as you mentioned.

Waiting for the official team to resolve this issue~😀

@najuzilu
Copy link

najuzilu commented May 23, 2023

@uncomtrade do you happen to know when this issue will be resolved?

@senn117
Copy link
Author

senn117 commented May 23, 2023

You can check if the search page on the official website can successfully fulfill your query (similar to calling an API).
[https://comtradeplus.un.org/TradeFlow?Frequency=M&Flows=X&CommodityCodes=0201&Partners=0&Reporters=124&period=201509&AggregateBy=none&BreakdownMode=plus]

If you're in a hurry, you can try contacting them through their official email or Twitter. I noticed they are quite active on Twitter, so you can give it a try. 😁

@najuzilu
Copy link

Thanks @senn117. I sent them an email; hoping they'll resolve this sooner rather than later since it seems to be affecting their web interface as well.

@senn117
Copy link
Author

senn117 commented May 23, 2023

You're welcome @najuzilu 😀. I also look forward to the issue being fixed smoothly by the official team. I use their API services to query data every month, which is very convenient.

@najuzilu
Copy link

It looks like the API is now working.
Screenshot 2023-05-23 at 3 24 32 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants