Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set user agent on API requests #23

Merged
merged 3 commits into from
Mar 5, 2023
Merged

Set user agent on API requests #23

merged 3 commits into from
Mar 5, 2023

Conversation

alex9smith
Copy link
Owner

The GDELT API seems to have started rate limiting requests without a user agent set (see #22). This PR sets the package name and version as the user agent for all requests to the API. Manual testing for rate limiting is an imprecise business, but I was able to reproduce the error before making this change and I've not seen it since.

This PR also restructures the versioning system slightly - this is needed so we can access the version number to set in the user agent.

Closes #22

We need to access the current version number in order to set a sensible
user agent. Before that's possible we need to move the definition out
of the `__init__.py` file so we don't get circular imports.
The API seems to have started rate limiting requests without a user
agent - see #22.
@alex9smith alex9smith merged commit 7da5ac8 into main Mar 5, 2023
@alex9smith alex9smith deleted the set-user-agent branch March 5, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recommended fix for rate limit response
1 participant