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

Support GitHub authorization token to bypass the unauthorized requests limit #102

Closed
teppyboy opened this issue Jul 28, 2022 · 6 comments
Closed
Labels
enhancement New feature or request

Comments

@teppyboy
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Continued from #95 (comment), tldr it's mostly useful for development & some rare cases (multiple application using GitHub API running, etc..) only.

Describe the solution you'd like
Support for an environment variable called PROTONUP_GITHUB_AUTHORIZATION_TOKEN, and read token from that variable.

Do not use arguments like --gh-auth-token because ps can read process arguments.

Describe alternatives you've considered
VPN to bypass, but using VPN is not really the right way to do.

Additional context
I can create a PR if you want :P

@teppyboy teppyboy added the enhancement New feature or request label Jul 28, 2022
@teppyboy
Copy link
Contributor Author

teppyboy commented Aug 3, 2022

bump xD

@DavidoTek
Copy link
Owner

We could define a requests.Session and set the headers:

s = requests.Session()
token = os.getenv('PROTONUP_GITHUB_AUTHORIZATION_TOKEN')
if token:
    s.headers.update({'Authorization': f'token {token}'})
###
s.get(url='', stream=False)

@teppyboy
Copy link
Contributor Author

teppyboy commented Aug 6, 2022

yep probably like that, but since requests.get is being used everywhere that means we have to refactor our code to use session from requests.Session()

@DavidoTek
Copy link
Owner

Should work now, feel free to do some testing!

@teppyboy
Copy link
Contributor Author

Sorry for late response, and yep it works flawlessly :P

@DavidoTek
Copy link
Owner

No problem, good to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants