Daniel Marchand
Daniel Marchand

Reputation: 644

How to get all unique email recipients python gmail api

I want to do a search for all unique email recipients from gmail. But I'm really struggling with API. If I was interacting with a SQL database I would want something like:

SELECT DISTINCT EmailRecipient FROM MyHypotheticalGmailTable;

But I'm not sure how to translate this into a gmail API call.

Upvotes: 0

Views: 278

Answers (1)

ale13
ale13

Reputation: 6072

I suggest you start by taking a look at the Gmail API Quickstart with Python here.

Afterwards you may want to take a look at threads.list in order to list all the threads available and then for each one use threads.get. Since there is no direct method of retrieving the unique email recipients, you will have to handle this separately from the API calls and filter the results programmatically.

Reference

Upvotes: 1

Related Questions