avryhof/ambient_api

get_data() responding with { } or None

apowers5321 opened this issue · 4 comments

Not sure why this is occurring, as this works fine on my PC and my laptop seems to draw empty data.
Followed the code provided. I'm still a novice coder at best so I'm still learning to troubleshoot this sort of stuff.

Screenshot 2023-05-25 155441

If it works on your PC, but not on your laptop, my first guess would be to make sure you migrated your API credentials correctly, and didn't do something like copy over invisible characters.

Following that, I would set the AMBIENT_LOG_LEVEL to debug, and watch your console. The HTTP Status codes return different messages. It might be helpful to see if you are rate limited, or something.

That's where I would start.

I will definitely double check the credentials, and as for setting the log level to debug, is that set as another environment variable or is that an argument within the API? (I'm at best a novice coder and know much about API's).

The easiest way is to pass it as a keyword argument

api = AmbientAPI(log_level="debug")

If debug doesn't work, you can also pass in console, which will just dump the errors with print() for old-school debugging :)

There are a few different arguments you can fiddle with.

Anything that uses kwargs.get(...) in the constructor can be passed in that way.

def __init__(self, **kwargs):

Thanks for the help! I was able to diagnose and fix the issue. Just needed some extra time to collect the data before outputting it to avoid the 429 limit.