Made it possible to run samples from the top-level directory and we now print out the created activity.

This commit is contained in:
ade@google.com
2010-09-27 22:31:46 +01:00
parent 973d1a6502
commit cfc39d1f74
2 changed files with 14 additions and 2 deletions

View File

@@ -11,12 +11,16 @@ latest content and then adds a new entry.
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
# Enable this sample to be run from the top-level directory
import os
import sys
sys.path.insert(0, os.getcwd())
from apiclient.discovery import build
import httplib2
import pickle
import pprint
def main():
f = open("buzz.dat", "r")
@@ -33,13 +37,16 @@ def main():
activitylist = activities.list_next(activitylist).execute()
print activitylist['items'][0]['title']
activities.insert(userId='@me', body={
activity = activities.insert(userId='@me', body={
'title': 'Testing insert',
'object': {
'content': u'Just a short note to show that insert is working. ☄',
'type': 'note'}
}
).execute()
pprint.pprint(activity)
print
print 'Just created: ', activity['links']['alternate'][0]['href']
if __name__ == '__main__':
main()

View File

@@ -22,6 +22,11 @@ other example apps in the same directory.
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
# Enable this sample to be run from the top-level directory
import os
import sys
sys.path.insert(0, os.getcwd())
from apiclient.discovery import build
from apiclient.oauth import FlowThreeLegged