Omkar008 commited on
Commit
347dbf6
1 Parent(s): 0eadc0e

Update test.py

Browse files
Files changed (1) hide show
  1. test.py +9 -9
test.py CHANGED
@@ -41,7 +41,7 @@ async def auth_google(request: Request):
41
  #We require the gmail.readonly scopes that requires verification of our application and all.
42
  data = await request.json()
43
  code = data.get("access_token")
44
- print("Printing the authorisation token")
45
  print(code)
46
  if not code:
47
  raise HTTPException(status_code=400, detail="Authorization code not provided")
@@ -86,7 +86,7 @@ async def auth_google(request: Request):
86
  break # No more pages, exit the loop
87
 
88
 
89
- print(len(messages))
90
 
91
 
92
  # query = "subject:receipt OR subject:receipts has:attachment"
@@ -101,8 +101,8 @@ async def auth_google(request: Request):
101
  attachment_no = 0
102
  data_new = {}
103
  for i,message in enumerate(messages) :
104
- print(i)
105
- print(message)
106
 
107
  if message:
108
  message_id = message.get("id")
@@ -127,11 +127,11 @@ async def auth_google(request: Request):
127
  data_new[filename]=data
128
  # data_new.append({filename:data.encode("UTF-8")})
129
  # Decode base64-encoded attachment data
130
- print(filename)
131
  attachment_content = base64.urlsafe_b64decode(data.encode("UTF-8"))
132
- print(attachment_content)
133
  print("yo")
134
- print(data_new)
135
  attachment_no+=1
136
 
137
  # if data:
@@ -145,8 +145,8 @@ async def auth_google(request: Request):
145
 
146
  # attachments.append(save_path)
147
 
148
- print(attachments)
149
- print(len(data_new))
150
  return {"attachment_count":attachment_no,"attachment_content":data_new}
151
 
152
  @app.get("/auth1/google")
 
41
  #We require the gmail.readonly scopes that requires verification of our application and all.
42
  data = await request.json()
43
  code = data.get("access_token")
44
+ print("Printing the access token")
45
  print(code)
46
  if not code:
47
  raise HTTPException(status_code=400, detail="Authorization code not provided")
 
86
  break # No more pages, exit the loop
87
 
88
 
89
+ # print(len(messages))
90
 
91
 
92
  # query = "subject:receipt OR subject:receipts has:attachment"
 
101
  attachment_no = 0
102
  data_new = {}
103
  for i,message in enumerate(messages) :
104
+ # print(i)
105
+ # print(message)
106
 
107
  if message:
108
  message_id = message.get("id")
 
127
  data_new[filename]=data
128
  # data_new.append({filename:data.encode("UTF-8")})
129
  # Decode base64-encoded attachment data
130
+ # print(filename)
131
  attachment_content = base64.urlsafe_b64decode(data.encode("UTF-8"))
132
+ # print(attachment_content)
133
  print("yo")
134
+ # print(data_new)
135
  attachment_no+=1
136
 
137
  # if data:
 
145
 
146
  # attachments.append(save_path)
147
 
148
+ # print(attachments)
149
+ # print(len(data_new))
150
  return {"attachment_count":attachment_no,"attachment_content":data_new}
151
 
152
  @app.get("/auth1/google")