thejagstudio commited on
Commit
25dece3
1 Parent(s): c05e4e0

Update home/views.py

Browse files
Files changed (1) hide show
  1. home/views.py +4 -10
home/views.py CHANGED
@@ -16,21 +16,15 @@ from pydrive.drive import GoogleDrive
16
  import requests
17
  import geocoder
18
  import folium
19
-
20
  gauth = GoogleAuth()
21
- gauth.LoadCredentialsFile("mycreds.txt")
22
- authUrl = gauth.GetAuthUrl()
23
- if gauth.credentials is None:
24
- # Authenticate if they're not there
25
- gauth.LocalWebserverAuth()
26
- elif gauth.access_token_expired:
27
  # Refresh them if expired
28
  gauth.Refresh()
29
  else:
30
- # Initialize the saved creds
31
  gauth.Authorize()
32
- # Save the current credentials to a file
33
- #gauth.SaveCredentialsFile("mycreds.txt")
34
  DRIVE = GoogleDrive(gauth)
35
 
36
 
 
16
  import requests
17
  import geocoder
18
  import folium
19
+ from oauth2client import client
20
  gauth = GoogleAuth()
21
+ content = os.environ.get('token')
22
+ gauth.credentials = client.Credentials.new_from_json(content)
23
+ if gauth.access_token_expired:
 
 
 
24
  # Refresh them if expired
25
  gauth.Refresh()
26
  else:
 
27
  gauth.Authorize()
 
 
28
  DRIVE = GoogleDrive(gauth)
29
 
30