如何从此页面获取帖子:https://www.tumblr.com/explore/trending through API?
我查看了文档,但一无所获.
我使用API将我的备份从服务器上传到我的谷歌硬盘.传递的授权没有问题,文件被上传,但文件没有出现在列表中.码:
import httplib2
import pprint
from apiclient.discovery import build
from oauth2client.client import SignedJwtAssertionCredentials
from apiclient.http import MediaFileUpload
f = file('privatekey.p12', 'rb')
key = f.read()
f.close()
credentials = SignedJwtAssertionCredentials('1234567890@developer.gserviceaccount.com', key, scope='https://www.googleapis.com/auth/drive')
http = httplib2.Http()
http = credentials.authorize(http)
drive_service = build('drive', 'v2', http=http)
media_body = MediaFileUpload('/path/to/file/document.txt', mimetype='text/plain', resumable=True)
body = {
'title': 'My document',
'description': 'A test document',
'mimeType': 'text/plain'
}
file = drive_service.files().insert(body=body, media_body=media_body).execute()
pprint.pprint(file)
Run Code Online (Sandbox Code Playgroud)
来自api的回复:
{u'alternateLink': u'https://docs.google.com/file/d/0B-FWSwzP0SeyamY1MXFIMmFDZWc/edit?usp=drivesdk',
u'appDataContents': False,
u'copyable': True,
u'createdDate': u'2014-01-04T14:41:19.108Z',
u'description': u'A test document',
u'downloadUrl': u'https://doc-0c-6s-docs.googleusercontent.com/docs/securesc/376up7hhina7i2kr3lb8jjr3i1qgs9i8/hbgdu1q3abhdnhdr75jrpjohg4aphvci/1388844000000/08619299632362135867/08619299632362135867/0B-FWSwzP0SeyamY1MXFIMmFDZWc?h=16653014193614665626&e=download&gd=true',
u'editable': …Run Code Online (Sandbox Code Playgroud)