jeremyephron / simplegmail

A simple Gmail API client for applications in Python
MIT License
336 stars 73 forks source link

linux box and client_secret.json #81

Closed jrios2006 closed 1 year ago

jrios2006 commented 1 year ago

In my linux machine, I use python 3.10.7 In folder /tmp I have a copy of my json credentials file

`[jra@AIO tmp]$ pwd /tmp [jra@AIO tmp]$ ls -l *.json -rw-r--r-- 1 jra jra 362 sep 29 08:13 client_secret_629008123798-bdjhkomddehsts3cb4r0nrd32splcsu1.apps.googleusercontent.com.json -rw-r--r-- 1 jra jra 362 sep 29 09:04 client_secret.json [jra@AIO tmp]$ python Python 3.10.7 (main, Sep 6 2022, 21:22:27) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import simplegmail gmail = simplegmail.Gmail() /usr/lib/python3.10/site-packages/oauth2client/_helpers.py:255: UserWarning: Cannot access gmail_token.json: No such file or directory warnings.warn(_MISSING_FILE_MESSAGE.format(filename)) Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/simplegmail/gmail.py", line 83, in init flow = client.flow_from_clientsecrets( File "/usr/lib/python3.10/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper return wrapped(*args, **kwargs) File "/usr/lib/python3.10/site-packages/oauth2client/client.py", line 2134, in flow_from_clientsecrets client_type, client_info = clientsecrets.loadfile(filename, File "/usr/lib/python3.10/site-packages/oauth2client/clientsecrets.py", line 165, in loadfile return _loadfile(filename) File "/usr/lib/python3.10/site-packages/oauth2client/clientsecrets.py", line 126, in _loadfile return _validate_clientsecrets(obj) File "/usr/lib/python3.10/site-packages/oauth2client/clientsecrets.py", line 99, in _validate_clientsecrets raise InvalidClientSecretsError( oauth2client.clientsecrets.InvalidClientSecretsError: Missing property "redirect_uris" in a client type of "web".

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.10/site-packages/simplegmail/gmail.py", line 94, in init raise FileNotFoundError( FileNotFoundError: Your 'client_secret.json' file is nonexistent. Make sure the file is in the root directory of your application. If you don't have a client secrets file, go to https://developers.google.com/gmail/api/quickstart/python, and follow the instructions listed there.

If i try to put the complete path >>> gmail = simplegmail.Gmail(client_secret_file='/tmp/client_secret.json') Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/simplegmail/gmail.py", line 83, in init flow = client.flow_from_clientsecrets( File "/usr/lib/python3.10/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper return wrapped(*args, **kwargs) File "/usr/lib/python3.10/site-packages/oauth2client/client.py", line 2134, in flow_from_clientsecrets client_type, client_info = clientsecrets.loadfile(filename, File "/usr/lib/python3.10/site-packages/oauth2client/clientsecrets.py", line 165, in loadfile return _loadfile(filename) File "/usr/lib/python3.10/site-packages/oauth2client/clientsecrets.py", line 126, in _loadfile return _validate_clientsecrets(obj) File "/usr/lib/python3.10/site-packages/oauth2client/clientsecrets.py", line 99, in _validate_clientsecrets raise InvalidClientSecretsError( oauth2client.clientsecrets.InvalidClientSecretsError: Missing property "redirect_uris" in a client type of "web".

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.10/site-packages/simplegmail/gmail.py", line 94, in init raise FileNotFoundError( FileNotFoundError: Your 'client_secret.json' file is nonexistent. Make sure the file is in the root directory of your application. If you don't have a client secrets file, go to https://developers.google.com/gmail/api/quickstart/python, and follow the instructions listed there. I use the last version of simplegmail [jra@AIO tmp]$ pip freeze | grep simplegmail simplegmail==4.0.4 ` Any ideas to connect with the gmail account?

jrios2006 commented 1 year ago

I have a created another credentials in Cloud Google web page and simplegmail is run with this credentials. I thin that the json file is imcomplete.