Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Rate Limiting #41

Open
stylesuxx opened this issue May 16, 2018 · 5 comments
Open

Rate Limiting #41

stylesuxx opened this issue May 16, 2018 · 5 comments
Assignees

Comments

@stylesuxx
Copy link

stylesuxx commented May 16, 2018

I am hitting rate limits. Unfortunately the library does not throw an according error, instead I get the following when trying to access the listing endpoint:

TypeError: 'JSONDecodeError' object is not subscriptable

I would suggest to propagate an error message here:

except Exception as e:

@barnumbirr
Copy link
Owner

Hello,

I'll look into it for the next release.

Cheers.

@barnumbirr barnumbirr self-assigned this May 29, 2018
@barnumbirr
Copy link
Owner

So I've looked into this yesterday evening and I don't think Coinmarketcap enforces rate limits: I queried the API every 0.5 seconds for well over 2 minutes and all responses were fine. This makes me think that the issue can be attributed to a small API downtime or error.

@stylesuxx
Copy link
Author

OK, unfortunately I don't have the code anymore, but I was querying the ticker by ID in a loop without any waiting time between the requests. It was more than the 30 requests per minute, that their API doc asks you to stay under => https://coinmarketcap.com/api/
It was reproducible over a couple of days, so not just a one time thing. I got a message that I have been blocked and only received the "cloudflare warning" page.

My suggestion would be, if you do not want to pass on a custom exception, then at least don't catch it - so users of the lib can quickly figure out what went wrong.

@alex-stout
Copy link
Contributor

alex-stout commented Jul 7, 2018

I was able to get the rate limiting. I accidentally didn't pause between my requests and exceed the 30 call per second limit. I'm not sure exactly how long I was blocked but it was more than 5 minutes. If I have time next week I'll look into handling the error.

@alex-stout
Copy link
Contributor

This issue should be handled with #46

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

No branches or pull requests

3 participants