How to change the gmail signature

Good afternoon. I need help to run a Python program. I'm creating a Python code to update the gmail signature of all users in my domain using the Gmail API. I'm using a service account to fetch user data from a spreadsheet via Google Sheets and to modify the user's signature. So far, I'm able to get the service account to access the spreadsheet, but when I try to change another user's signature, the following error occurs:

""Not Authorized to access this resource/api". Details: "[{'message': 'Not Authorized to access this resource/api', 'domain': 'global', 'reason': 'forbidden'}]">"

What is necessary to perform the modification?"
The following snippet modifies the signature:


try:
service.users().update(userKey=email, body=body).execute()
print(f"Email signature updated for {email}")
time.sleep(0.5)
except Exception as e:
print(f"Error updating email signature for {email}: {str(e)}")

break # Exit the loop after finding the requested user

print("Process completed.")

 

0 1 148
1 REPLY 1

Hello levifarias,

I see your question is about coding with python to update GMAIL signatures for all domain users. Have you tried posting this question in the Stack Overflow forums?  As I'm not a coder myself but know from experience the coders at Stack Overflow are always patient and willing to help.

Best,

Draz the Nerd