Stage 1 conversion to JSON for storing Credentials.
Reviewed in http://codereview.appspot.com/4972065/
diff --git a/samples/appengine_with_decorator2/main.py b/samples/appengine_with_decorator2/main.py
index 03963f4..4cd2401 100644
--- a/samples/appengine_with_decorator2/main.py
+++ b/samples/appengine_with_decorator2/main.py
@@ -43,8 +43,7 @@
decorator = OAuth2Decorator(
client_id='837647042410-75ifgipj95q4agpm0cs452mg7i2pn17c.apps.googleusercontent.com',
client_secret='QhxYsjM__u4vy5N0DXUFRwwI',
- scope='https://www.googleapis.com/auth/buzz',
- user_agent='my-sample-app/1.0')
+ scope='https://www.googleapis.com/auth/buzz')
http = httplib2.Http(memcache)
service = build("buzz", "v1", http=http)
diff --git a/samples/buzz/buzz.py b/samples/buzz/buzz.py
index 2fb4e85..8906048 100644
--- a/samples/buzz/buzz.py
+++ b/samples/buzz/buzz.py
@@ -88,6 +88,7 @@
# Credentials will get written back to a file.
storage = Storage('buzz.dat')
credentials = storage.get()
+
if credentials is None or credentials.invalid:
credentials = run(FLOW, storage)
@@ -112,31 +113,10 @@
activitylist = activities.list_next(activitylist).execute()
print "Retrieved the next two activities"
- # Add a new activity
- new_activity_body = {
- 'title': 'Testing insert',
- 'object': {
- 'content':
- u'Just a short note to show that insert is working. ☄',
- 'type': 'note'}
- }
- activity = activities.insert(userId='@me', body=new_activity_body).execute()
- print "Added a new activity"
-
- activitylist = activities.list(
- max_results='2', scope='@self', userId='@me').execute()
-
- # Add a comment to that activity
- comment_body = {
- "content": "This is a comment"
- }
- item = activitylist['items'][0]
- comment = service.comments().insert(
- userId=item['actor']['id'], postId=item['id'], body=comment_body
- ).execute()
- print 'Added a comment to the new activity'
- pprint.pprint(comment)
-
+ # List the number of followers
+ followers = service.people().list(
+ userId='@me', groupId='@followers').execute(http)
+ print 'Hello, you have %s followers!' % followers['totalResults']
except AccessTokenRefreshError:
print ("The credentials have been revoked or expired, please re-run"
diff --git a/samples/moderator/moderator.py b/samples/moderator/moderator.py
index b7da058..e92ef1b 100644
--- a/samples/moderator/moderator.py
+++ b/samples/moderator/moderator.py
@@ -140,8 +140,6 @@
body=vote_body)
print "Voted on the submission"
-
-
except AccessTokenRefreshError:
print ("The credentials have been revoked or expired, please re-run"
"the application to re-authorize")
diff --git a/samples/prediction/prediction.py b/samples/prediction/prediction.py
index 3ffa974..1227019 100644
--- a/samples/prediction/prediction.py
+++ b/samples/prediction/prediction.py
@@ -109,7 +109,7 @@
# Start training on a data set
train = service.training()
- body = {'id' : FLAGS.object_name}
+ body = {'id': FLAGS.object_name}
start = train.insert(body=body).execute()
print 'Started training'
diff --git a/samples/src/moderator.py b/samples/src/moderator.py
index 1ab9ea8..e27b811 100644
--- a/samples/src/moderator.py
+++ b/samples/src/moderator.py
@@ -43,4 +43,3 @@
submissionId=submission['id']['submissionId'],
body=vote_body)
print "Voted on the submission"
-