I found this question but the problem seems to persist. When I run
result = requests.get("https://api.etc.com/v1/something", params=payload).json()
and then run
print(type(result))
print(type(result['data'][0]))
I get the types 'dict' and 'string' (or something like that) as you would expect.
However, I'm getting a "rate limit exceeded" error from the API at that last line on the console. If we're really storing the results in result
, why does an API request appear to be generated from that line?
The aim is to store the API request result in a variable to then probe its contents freely without triggering further requests. How do I do that? Is something else going on? The console points specifically to that line when moaning about request rate limits.
Sometimes the error is triggered by other lines. For example, the latest output of the console is
> {'message': 'rate_limit_exceeded', 'status': 'error'}
Traceback (most recent call last):
File "/Users/User/folder/code.py", line 85, in <module>
derivative_resuslt = result['data'][0]
KeyError: 'data'