Closed lazarust closed 3 years ago
In the Census API, there is a 500 queries per IP address per day limit without using an API key (see 'Query Limits' in the Census Data API User Guide). An API key can be requested here. Without that key, you'll get the 429 Client Error
once the 500 query limit is passed.
Once you have that key, you can use cenpy
to save your key to SITEKEY.txt
which will make it accessible in future sessions.
Run the following once, to create SITEKEY.txt
in a known location.:
import cenpy
KEY = "a4b2eab7c7050050923fffa485fb81e22be63e68" # Census API key
cenpy.set_sitekey(KEY)
In future sessions, you shouldn't have to pass in the key and cenpy
will load it accordingly.
import cenpy
acs = cenpy.ACS(2019)
print(acs._api.apikey)
> a4b2eab7c7050050923fffa485fb81e22be63e68
From there, you'll be able to avoid this error.
Thank you so much @ronnie-llamado! I'll go ahead and close this issue then.
I'm using cenpy version
1.0.0.post4
within a docker web container. When I run this block of code:I get the following error:
This seems to have just started recently and I haven't changed anything with my environment that I can think of. Any help would be greatly appreciated!