Skip to content

being polite to api's #1821

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

unibik
Copy link

@unibik unibik commented Mar 20, 2025

fix: #506
Implemented polite_request to enforce API rate limits and delays

@unibik unibik changed the title fix #506 fix #506 being polite to api's Mar 20, 2025
@unibik unibik changed the title fix #506 being polite to api's being polite to api's Mar 20, 2025
@@ -266,7 +309,7 @@ def _get_gh_response(gh_token, graphql_query):
"""
endpoint = "https://api.github.com/graphql"
headers = {"Authorization": f"bearer {gh_token}"}
return requests.post(endpoint, headers=headers, json=graphql_query).json()
return polite_request(endpoint, headers=headers, json=graphql_query).json()
Copy link
Contributor

@TG1999 TG1999 Apr 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why will this work as a GET request and not a POST request ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @TG1999 for spending your time on my PR and spotting this. You are absolutely right. This should work as a POST request. I should have passed method='POST' .
I'll update _get_gh_response() accordingly to ensure it sends a proper POST request

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.

Be polite to APIs
2 participants