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

Fix AttributeError in OAuth2 token handling #83

Closed
wants to merge 1 commit into from
Closed

Fix AttributeError in OAuth2 token handling #83

wants to merge 1 commit into from

Conversation

masrlinu
Copy link
Contributor

@masrlinu masrlinu commented Aug 1, 2023

This PR addresses an issue where access_token and pc_hostname attributes were not accessible in the TokenHandler.get_access_token method, leading to an AttributeError. The HTTPServer object was being used, which didn't have these attributes.

The fix involves creating a new HTTPServerWithAttributes class that inherits from HTTPServer and includes these additional attributes. This class is used instead when creating the server in the TokenHandler.get_access_token method.

The PR also modifies the start_server inner function to use serve_forever instead of handle_request, and adds a call to http_server.shutdown() after the access token is retrieved to ensure the server properly shuts down.

With these changes, the OAuth2 authorization flow should work as expected, correctly retrieving and using the access token for pCloud API requests.

@tomgross
Copy link
Owner

Superseeded by #90

@tomgross tomgross closed this Feb 29, 2024
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.

2 participants