Skip to content
This repository
Browse code

proper datetime formatting

  • Loading branch information...
commit 76a64f261c5c0161d1d52914f69af01363ffed3a 1 parent 59d4b19
washort authored January 02, 2013

Showing 1 changed file with 6 additions and 4 deletions. Show diff stats Hide diff stats

  1. 10  scripts/auth_google_analytics.py
10  scripts/auth_google_analytics.py
@@ -11,12 +11,12 @@
11 11
 --noauth_local_webserver as well.)
12 12
 Paste the printed credentials into the Django settings file.
13 13
 """
14  
-
  14
+import json
15 15
 import pprint
16 16
 import sys
17 17
 
18 18
 import gflags
19  
-from oauth2client.client import flow_from_clientsecrets, Storage
  19
+from oauth2client.client import flow_from_clientsecrets, Storage, EXPIRY_FORMAT
20 20
 from oauth2client.tools import run
21 21
 
22 22
 gflags.DEFINE_string('secrets', None, 'Client secret JSON filename', short_name='f')
@@ -38,9 +38,11 @@
38 38
 s.put = lambda *a, **kw: None
39 39
 credentials = run(FLOW, s)
40 40
 
41  
-bits = dict([(name, getattr(credentials, name)) for name in
  41
+bits = dict([(str(name), str(getattr(credentials, name))) for name in
42 42
              ('access_token', 'client_id', 'client_secret',
43  
-              'refresh_token', 'token_expiry', 'token_uri',
  43
+              'refresh_token', 'token_uri',
44 44
               'user_agent')])
  45
+bits['token_expiry'] = credentials.token_expiry.strftime(EXPIRY_FORMAT)
45 46
 print 'GOOGLE_ANALYTICS_CREDENTIALS = ',
46 47
 pprint.pprint(bits)
  48
+

0 notes on commit 76a64f2

Please sign in to comment.
Something went wrong with that request. Please try again.