This is a Python script that adds photos to the user's contacts in Zoho Contacts in Zoho Mail.
This script downloads a list of all the user's contacts from Zoho Mail, attempts to locate a photo for each one, and if found it uploads that photo to the contact.
It relies on the backdoor solution of using the user's cookies to grant access to Zoho Mail. This is partly because adding a photo to a contact is not part of their official API.
The contact photos are stored in a folder (named photos
by default) and are saved in the
format *Firstname*Lastname*.jpg
. The *
is a wildcard that represents anything, so suffixes and prefixes won't cause
photos to be missed. You can get these photos anywhere, but I was able to source mine from my Google Contacts
using Google Takeout.
- Download the script and install Python 3.8 and the requirements in
requirements.txt
. - Have a folder named
photos
in the current directory with the contacts photos.- These should be saved in the format
*Firstname*Lastname*.jpg
. The*
is a wildcard that represents anything ( such as spaces, suffixes, or prefixes). - These can be downloaded straight from Google Contacts using Google Takeout.
- These should be saved in the format
- Open Google Chrome or Microsoft Edge and log into Zoho Mail at mail.zoho.com.
- Open a new tab, open the developer tools (F12), and go to the Network tab.
- In the new tab visit https://mail.zoho.com/zm/zc/api/v1/accounts/self/contacts and look for the request to the contacts page in the Network tab (see screenshot below).
- Open this request, go to the Headers tab, and under the Request Headers section, copy the Cookie header value.
- Run the script, and paste the cookies you copied when prompted.
python -m update_photos
will run the script. It runs completely in the terminal.