Skip to content

Be polite to API, respect rate limits - #1821

Open
unibik wants to merge 3 commits into
aboutcode-org:mainfrom
unibik:being-polite-to-apis
Open

Be polite to API, respect rate limits#1821
unibik wants to merge 3 commits into
aboutcode-org:mainfrom
unibik:being-polite-to-apis

Conversation

@unibik

@unibikunibik commented Mar 20, 2025

Copy link
Copy Markdown

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

@unibikunibik changed the title fix #506 fix #506 being polite to api'sMar 20, 2025
@unibikunibik changed the title fix #506 being polite to api'sbeing polite to api'sMar 20, 2025
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()

@TG1999TG1999Apr 18, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

@pombredannepombredanne changed the title being polite to api'sBe polite to API, repect rate limitsMay 12, 2025
@pombredannepombredanne changed the title Be polite to API, repect rate limitsBe polite to API, respect rate limitsMay 12, 2025
@TG1999

Copy link
Copy Markdown
Contributor

@unibik gentle ping on this, what's the progress here ?

@unibik

unibik commented Sep 8, 2025

Copy link
Copy Markdown
Author

Hey @TG1999 , thanks for the reminder! I had paused open-source work for a while after GSoC and continued doing bug bounty programs, but I’d like to pick this up again. I’ll revisit the PR and push the required changes soon.... By the way sorry for late reply, i was busy in my college exams..

Sign up for freeto 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

@unibik@TG1999