How can I post on blogger with Python and googleapiclient

Asked

Viewed 16 times

0

I’m trying to make a program that automatically posts on a website of mine, which I did on the blogger. How can I do this? My code is like this:

    from googleapiclient.discovery import build
    Key = "****************************************"
    BlogId = "6904625182923640825"
    blog = build('blogger', 'v3', developerKey=Key)
    def getblog():
        title = []
        url = []
        NextPage = None
        while 1:
            resp = blog.posts().list(blogId=BlogId, maxResults=1, pageToken = NextPage).execute()
            print(resp)
            try:
                title.append(resp['items'][0]['title'])
                url.append(resp['items'][0]['url'])
            except KeyError:
                break
            NextPage = resp.get('nextPageToken', None)       
            if NextPage is None:
                break
        return title, url, resp
title, url, resp = getblog()

(I set the key to ****************************************)

  • 1

    You have already asked this: https://answall.com/q/490798/5878

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.