Skip to content

Example code of OAuth2 with public client temporary tokens #103

@rdpickard

Description

@rdpickard

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions