google / gmail-oauth2-tools

Tools and sample code for authenticating to Gmail with OAuth2
Apache License 2.0
405 stars 211 forks source link

oauth2.py not working with python3 #27

Closed jen-mckaig closed 11 months ago

jen-mckaig commented 4 years ago

Hi there,

I am not able to get oauth2.py library working in python 3, any chance it will get updated?

mathstuf commented 4 years ago

See #25.

davama commented 3 years ago

Looks like with python 3.9.1 it does not work.

Traceback (most recent call last):
  File "/home/dmacias/.mutt/oauth2.py", line 366, in <module>
    main(sys.argv)
  File "/home/dmacias/.mutt/oauth2.py", line 325, in main
    response = RefreshToken(options.client_id, options.client_secret,
  File "/home/dmacias/.mutt/oauth2.py", line 255, in RefreshToken
    return json.loads(response, encoding='utf-8')
  File "/usr/lib/python3.9/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
TypeError: __init__() got an unexpected keyword argument 'encoding'

Changed first line to below help me to get it working again:

#!/usr/bin/env python2
junyer commented 11 months ago

Fixed in commit 944cffd66df38863eb0252a8096961335e418e70.