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

Example code of OAuth2 with public client temporary tokens #103

Open
rdpickard opened this issue Jan 17, 2022 · 0 comments
Open

Example code of OAuth2 with public client temporary tokens #103

rdpickard opened this issue Jan 17, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@rdpickard
Copy link

Hi all,

Thanks for all the work on this module.

I have created an example of using the module with OAuth2 public clients. The example code is here in a gist.

The script itself will 'Unlike' all of a user's liked Tweets. So run as-is with caution.

The interesting bit is the WrappedPyTwitterAPI subclass of pytwitter.Api.

The example will handle a few things I did not see in other examples

  • capturing the OAuth2 callback from inside the app
  • refreshing access tokens that Public Client apps get when they expire
  • detecting errors that can be recovered from, such as Rate Limit exceeded and token expired.

Hope this is helpful.

@MerleLiuKun MerleLiuKun added the enhancement New feature or request label Mar 18, 2022
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