44
44
def main (argv ):
45
45
# Authenticate and construct service.
46
46
service , flags = sample_tools .init (
47
- argv , 'plus ' , 'v1 ' , __doc__ , __file__ ,
47
+ argv , 'blogger ' , 'v3 ' , __doc__ , __file__ ,
48
48
scope = 'https://www.googleapis.com/auth/blogger' )
49
49
50
- service = build ('blogger' , 'v2' , http = http )
51
-
52
50
try :
53
51
54
52
users = service .users ()
55
53
56
54
# Retrieve this user's profile information
57
- thisuser = users .get (userId = 'self' ).execute (http = http )
55
+ thisuser = users .get (userId = 'self' ).execute ()
58
56
print ('This user\' s display name is: %s' % thisuser ['displayName' ])
59
57
58
+ blogs = service .blogs ()
59
+
60
60
# Retrieve the list of Blogs this user has write privileges on
61
- thisusersblogs = users . blogs (). list (userId = 'self' ).execute ()
61
+ thisusersblogs = blogs . listByUser (userId = 'self' ).execute ()
62
62
for blog in thisusersblogs ['items' ]:
63
63
print ('The blog named \' %s\' is at: %s' % (blog ['name' ], blog ['url' ]))
64
64
@@ -69,7 +69,7 @@ def main(argv):
69
69
print ('The posts for %s:' % blog ['name' ])
70
70
request = posts .list (blogId = blog ['id' ])
71
71
while request != None :
72
- posts_doc = request .execute (http = http )
72
+ posts_doc = request .execute ()
73
73
if 'items' in posts_doc and not (posts_doc ['items' ] is None ):
74
74
for post in posts_doc ['items' ]:
75
75
print (' %s (%s)' % (post ['title' ], post ['url' ]))
0 commit comments