Skip to content

Commit b611971

Browse files
committed
commented code for token expiration
1 parent ab54683 commit b611971

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

indi_allsky/flask/youtube_views.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#from datetime import datetime
2+
#from datetime import timezone
13
import json
24
import requests
35

@@ -88,6 +90,15 @@ def dispatch_request(self):
8890
abort(400, 'InvalidGrantError: {0:s}'.format(str(e)))
8991

9092

93+
### Not sure if the token expiration is the same as the refresh_token expiration
94+
#now_utc = datetime.now(tz=timezone.utc)
95+
#expire_delta = flow.credentials.expiry - now_utc.replace(tzinfo=None)
96+
#expire_days = int(expire_delta.total_seconds() / 86400)
97+
#expire_hours = int((expire_delta.total_seconds() % 86400) / 3600)
98+
#expire_minutes = int(((expire_delta.total_seconds() % 86400) % 3600) / 60)
99+
#app.logger.info('Token expires at %s UTC in %d days, %d hours, %d minutes', str(flow.credentials.expiry), expire_days, expire_hours, expire_minutes)
100+
101+
91102
credentials_dict = self.credentials_to_dict(flow.credentials)
92103

93104
credentials_json = json.dumps(credentials_dict)

0 commit comments

Comments
 (0)