Innarticles / nlp-smart-email-replier

Given a history of email responses, Suggest the best reply for a given email.
MIT License
0 stars 1 forks source link

As a service (on Jupyter or via flask api), I can fetch emails from Gmail #2

Open Innarticles opened 4 years ago

Innarticles commented 4 years ago

Using Gmail's API, create a function that can consume this API to get emails content from a particular email address. The given email will give access to the service/function.

Danselem commented 4 years ago

I have installed gmail python app on my PC and have authenticated it.

Will keep you posted when I'm done.

Danselem commented 4 years ago

Alright. I'll work on it.

I have enabled Gmail API on my email and trying out some examples.

I found this code examples very interesting.

https://github.com/abhishekchhibber/Gmail-Api-through-Python/blob/master/gmail_read.py and

https://codehandbook.org/how-to-read-email-from-gmail-api-using-python/

Still working on it.

Innarticles commented 4 years ago

I agree. Those two are good directions. Remember to expose the keys for Gmail authentication to the ENV so we can easily swap them without changing the code.

Danselem commented 4 years ago

Noted. I'll work on it.

Danselem commented 4 years ago

I agree. Those two are good directions. Remember to expose the keys for Gmail authentication to the ENV so we can easily swap them without changing the code.

Noted. I'll work on it

Danselem commented 4 years ago

I agree. Those two are good directions. Remember to expose the keys for Gmail authentication to the ENV so we can easily swap them without changing the code.

Noted. I'll work on it

Good morning. Do you have any idea on how I can achieve this with json file?

I am familiar with exporting username and password in .env for a project.

Innarticles commented 4 years ago

I am not sure you need to use a JSON file. See this https://stackoverflow.com/questions/57063609/exporting-environment-variables-for-flask-application-in-windows. I am assuming you are on windows.

Danselem commented 4 years ago

I am not sure you need to use a JSON file. See this https://stackoverflow.com/questions/57063609/exporting-environment-variables-for-flask-application-in-windows. I am assuming you are on windows.

I'm using Linux Ubuntu

Danselem commented 4 years ago

Good evening.

How're you doing?

What output features do we intend to obtain from the search function?

Innarticles commented 4 years ago

Search filter:

  1. Filter by start date and end date
  2. Filter by subject text: E.g Find all emails that contain the words "xx xxx" in their subject.
Danselem commented 4 years ago

Following the answers from this post https://stackoverflow.com/questions/24428246/retrieve-email-message-body-in-html-using-gmail-api?rq=1.

I parsed the gmail message body as a beautiful soup element in the form: soup = BeautifulSoup(clean_two , "html.parser" ) then tried to obtain the text as:

text = soup.body.get_text()

This returned a text with numerous tag elements like \n, \r, \xa0 still on it.

I am still looking for a means to clean it further. Again, I'll test this with other mails to find out if it will return similar tags.

Danselem commented 4 years ago

Whats your take on the pull request? Where you able to check it out?