Open stylesuxx opened 6 years ago
Hello,
I'll look into it for the next release.
Cheers.
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.
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.
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.
This issue should be handled with #46
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: https://github.com/barnumbirr/coinmarketcap/blob/4e90337bdb467010d310bd796b898acef67d370a/coinmarketcap/core.py#L44