Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ffe845f

Browse files
Merge pull request googleapis#109 from seppide/master
Fix blogger API sample.
2 parents eee38fa + 952a1c7 commit ffe845f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

samples/blogger/blogger.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,21 @@
4444
def main(argv):
4545
# Authenticate and construct service.
4646
service, flags = sample_tools.init(
47-
argv, 'plus', 'v1', __doc__, __file__,
47+
argv, 'blogger', 'v3', __doc__, __file__,
4848
scope='https://www.googleapis.com/auth/blogger')
4949

50-
service = build('blogger', 'v2', http=http)
51-
5250
try:
5351

5452
users = service.users()
5553

5654
# Retrieve this user's profile information
57-
thisuser = users.get(userId='self').execute(http=http)
55+
thisuser = users.get(userId='self').execute()
5856
print('This user\'s display name is: %s' % thisuser['displayName'])
5957

58+
blogs = service.blogs()
59+
6060
# 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()
6262
for blog in thisusersblogs['items']:
6363
print('The blog named \'%s\' is at: %s' % (blog['name'], blog['url']))
6464

@@ -69,7 +69,7 @@ def main(argv):
6969
print('The posts for %s:' % blog['name'])
7070
request = posts.list(blogId=blog['id'])
7171
while request != None:
72-
posts_doc = request.execute(http=http)
72+
posts_doc = request.execute()
7373
if 'items' in posts_doc and not (posts_doc['items'] is None):
7474
for post in posts_doc['items']:
7575
print(' %s (%s)' % (post['title'], post['url']))

0 commit comments

Comments
 (0)