Omkar008 commited on
Commit
d3d961d
1 Parent(s): 5ae1597

Update get_gmail_data.py

Browse files
Files changed (1) hide show
  1. get_gmail_data.py +7 -1
get_gmail_data.py CHANGED
@@ -53,7 +53,7 @@ class GmailDataExtractor:
53
  access_token = self.__jwt
54
  print("access token")
55
  print(access_token)
56
- receipt_query = f'(subject:"your order" OR subject:receipts OR subject:receipt OR subject:invoice OR subject:invoice OR category:purchases)&maxResults=3'
57
  if self.__user_input is not None:
58
  receipt_query = f'(subject:"your order" OR subject:receipts OR subject:receipt OR subject:invoice OR subject:invoice OR category:purchases) AND subject:{self.__user_input}'
59
  gmail_url = f"https://www.googleapis.com/gmail/v1/users/me/messages?q={receipt_query}&maxResults=3"
@@ -148,6 +148,8 @@ class GmailDataExtractor:
148
  for header in headers:
149
  if header['name'] == 'Subject':
150
  subject = header['value']
 
 
151
  body = ''
152
  text=''
153
  links = []
@@ -165,6 +167,10 @@ class GmailDataExtractor:
165
  if fromdata['name'] == 'From':
166
  company_from_gmail = self.extract_domain_from_email(fromdata['value'])
167
  break
 
 
 
 
168
 
169
  for part in parts:
170
  if 'mimeType' not in part:
 
53
  access_token = self.__jwt
54
  print("access token")
55
  print(access_token)
56
+ receipt_query = f'(subject:"your order" OR subject:receipts OR subject:receipt OR subject:invoice OR subject:invoice OR category:purchases)&maxResults=15'
57
  if self.__user_input is not None:
58
  receipt_query = f'(subject:"your order" OR subject:receipts OR subject:receipt OR subject:invoice OR subject:invoice OR category:purchases) AND subject:{self.__user_input}'
59
  gmail_url = f"https://www.googleapis.com/gmail/v1/users/me/messages?q={receipt_query}&maxResults=3"
 
148
  for header in headers:
149
  if header['name'] == 'Subject':
150
  subject = header['value']
151
+
152
+
153
  body = ''
154
  text=''
155
  links = []
 
167
  if fromdata['name'] == 'From':
168
  company_from_gmail = self.extract_domain_from_email(fromdata['value'])
169
  break
170
+ if 'chanel' in subject.lower():
171
+ company_from_gmail = 'chanel'
172
+ if 'louis vuitton' in subject.lower():
173
+ company_from_gmail = 'Louis Vuitton'
174
 
175
  for part in parts:
176
  if 'mimeType' not in part: