小编rys*_*bsk的帖子

如何在 Python 中使用 Google Blogger API?

我正在尝试使用 Google API gdata 中的博客功能。我尽力按照文档进行操作,但失败得很厉害。谁能告诉我如何使用 Google 博客 API?我的代码非常混乱,现在我一无所知。

编辑完整的工作代码:):

from oauth2client.client import OAuth2WebServerFlow
import httplib2
from apiclient.discovery import build
from oauth2client.file import Storage

#flow = OAuth2WebServerFlow(client_id='', #ID
#                           client_secret='', #SECRET ID
#                           scope='https://www.googleapis.com/auth/blogger',
#                           redirect_uri='urn:ietf:wg:oauth:2.0:oob')

#auth_uri = flow.step1_get_authorize_url()
# Redirect the user to auth_uri on your platform.

# Open a file
#fo = open("foo.txt", "wb")
#fo.write( auth_uri +"\n");
#fo.close()

#credentials = flow.step2_exchange( raw_input ( ) ) 


storage = Storage('a_credentials_file')
#storage.put(credentials)

credentials = storage.get()

http = httplib2.Http()
http = credentials.authorize(http)

service …
Run Code Online (Sandbox Code Playgroud)

python blogger blogspot

5
推荐指数
1
解决办法
3265
查看次数

标签 统计

blogger ×1

blogspot ×1

python ×1