Hi I have this error in my task, but not at all when I run the code. Can you help me and explain to me why and how to manage ?
I repeat the token is ok and my code is working when I run it.
Kind regards Antoine
2023-08-08 21:25:36 - Task preparing to start
Aug 8 21:25:54 Traceback (most recent call last):
Aug 8 21:25:54 File "/home/Digimidi/gmail/gmailwhispergptandback.py", line 39, in authenticateGmailAPIs
Aug 8 21:25:54 creds.refresh(Request())
Aug 8 21:25:54 File "/usr/local/lib/python3.10/site-packages/google/oauth2/credentials.py", line 302, in refresh
Aug 8 21:25:54 ) = reauth.refresh_grant(
Aug 8 21:25:54 File "/usr/local/lib/python3.10/site-packages/google/oauth2/reauth.py", line 347, in refresh_grant
Aug 8 21:25:54 _client._handle_error_response(response_data)
Aug 8 21:25:54 File "/usr/local/lib/python3.10/site-packages/google/oauth2/_client.py", line 60, in _handle_error_response
Aug 8 21:25:54 raise exceptions.RefreshError(error_details, response_data)
Aug 8 21:25:54 google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', {'error': 'invalid_grant', 'error_description': 'Token has been expired or revoked.'})
Aug 8 21:25:54 During handling of the above exception, another exception occurred:
Aug 8 21:25:54 Traceback (most recent call last):
Aug 8 21:25:54 File "/home/Digimidi/gmail/gmailwhispergptandback.py", line 540, in <module>
Aug 8 21:25:54 main_extended()
Aug 8 21:25:54 File "/home/Digimidi/gmail/gmailwhispergptandback.py", line 505, in main_extended
Aug 8 21:25:54 service = authenticateGmailAPIs()
Aug 8 21:25:54 File "/home/Digimidi/gmail/gmailwhispergptandback.py", line 46, in authenticateGmailAPIs
Aug 8 21:25:54 send_warning_email(f"Error occurred while refreshing or authenticating the Gmail API token: {str(e)}")
Aug 8 21:25:54 File "/home/Digimidi/gmail/gmailwhispergptandback.py", line 53, in send_warning_email
Aug 8 21:25:54 service = build('gmail', 'v1', credentials=creds)
Aug 8 21:25:54 NameError: name 'creds' is not defined. Did you mean: 'credits'?
Aug 8 21:25:58 Traceback (most recent call last):
Aug 8 21:25:58 File "/home/Digimidi/gmail/gmailwhispergptandback.py", line 39, in authenticateGmailAPIs
Aug 8 21:25:58 creds.refresh(Request())
Aug 8 21:25:58 File "/usr/local/lib/python3.10/site-packages/google/oauth2/credentials.py", line 302, in refresh
Aug 8 21:25:58 ) = reauth.refresh_grant(
Aug 8 21:25:58 File "/usr/local/lib/python3.10/site-packages/google/oauth2/reauth.py", line 347, in refresh_grant
Aug 8 21:25:58 _client._handle_error_response(response_data)
Aug 8 21:25:58 File "/usr/local/lib/python3.10/site-packages/google/oauth2/_client.py", line 60, in _handle_error_response
Aug 8 21:25:58 raise exceptions.RefreshError(error_details, response_data)
Aug 8 21:25:58 google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', {'error': 'invalid_grant', 'error_description': 'Token has been expired or revoked.'})
Aug 8 21:25:58 During handling of the above exception, another exception occurred:
Aug 8 21:25:58 Traceback (most recent call last):
Aug 8 21:25:58 File "/home/Digimidi/gmail/gmailwhispergptandback.py", line 540, in <module>
Aug 8 21:25:58 main_extended()
Aug 8 21:25:58 File "/home/Digimidi/gmail/gmailwhispergptandback.py", line 505, in main_extended
Aug 8 21:25:58 service = authenticateGmailAPIs()
Aug 8 21:25:58 File "/home/Digimidi/gmail/gmailwhispergptandback.py", line 46, in authenticateGmailAPIs
Aug 8 21:25:58 send_warning_email(f"Error occurred while refreshing or authenticating the Gmail API token: {str(e)}")
Aug 8 21:25:58 File "/home/Digimidi/gmail/gmailwhispergptandback.py", line 53, in send_warning_email
Aug 8 21:25:58 service = build('gmail', 'v1', credentials=creds)
Aug 8 21:25:58 NameError: name 'creds' is not defined. Did you mean: 'credits'?