gavinzli commited on
Commit
f5ee9cf
·
1 Parent(s): d465d96

Move pickle files to cache directory for better organization

Browse files
Files changed (2) hide show
  1. app/router/auth.py +1 -1
  2. app/router/mail.py +1 -1
app/router/auth.py CHANGED
@@ -90,6 +90,6 @@ async def google_callback(code: str, request: Request):
90
  # ))
91
  service = build("gmail", "v1", credentials=credentials)
92
  profile = service.users().getProfile(userId="me").execute()
93
- with open(f"{profile['emailAddress']}.pickle", "wb") as token:
94
  pickle.dump(credentials, token)
95
  return JSONResponse(profile)
 
90
  # ))
91
  service = build("gmail", "v1", credentials=credentials)
92
  profile = service.users().getProfile(userId="me").execute()
93
+ with open(f"cache/{profile['emailAddress']}.pickle", "wb") as token:
94
  pickle.dump(credentials, token)
95
  return JSONResponse(profile)
app/router/mail.py CHANGED
@@ -22,7 +22,7 @@ def collect(email: str, request: Request):
22
  str: The generated response from the chat function.
23
  """
24
  if os.path.exists(f"{email}.pickle"):
25
- with open(f"{email}.pickle", "rb") as token:
26
  credentials = pickle.load(token)
27
  else:
28
  cred_dict = request.state.session.get("credential")
 
22
  str: The generated response from the chat function.
23
  """
24
  if os.path.exists(f"{email}.pickle"):
25
+ with open(f"cache/{email}.pickle", "rb") as token:
26
  credentials = pickle.load(token)
27
  else:
28
  cred_dict = request.state.session.get("credential")