tumblr / pytumblr

A Python Tumblr API v2 Client
Apache License 2.0
723 stars 196 forks source link

Janicelee/add oauth2 #116

Closed janicejellee closed 2 years ago

janicejellee commented 6 years ago

Authenticating with OAuth2

This adds support for authenticating any request in the client with OAuth2.

I also added interactive_console2.py which behaves like the the original interactive console, giving you access tokens if you supply info.

Let me know if you see any issues, have any code review comments, or think I should organize the files differently, integrate files together, etc. 👀I haven't figured out why the build fails either.

I have not added documentation yet either.

Testing

I added additional tests for Client2, which are just the existing tests but edited.

You can also test by making calls like this with your access token:

    client = TumblrRestClient2(
        "your-client-id",
        {'access_token': 'acess-token', 'token_type': 'bearer', 'expires_in': '2520', 'id_token': 'False', 'scope': ['basic']} 
    )

    info = client.info()
    following = client.following()
    print (following)
    follow = client.follow("blog-name")
    print (follow)

@ceyko