获取客户机m的响应发现json

2024-09-19 23:33:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用googleapi mocker,如下文档所述。但是对于日历API,不是书本API。你知道吗

from apiclient.discovery import build
from apiclient.http import HttpMock
import pprint

http = HttpMock('books-discovery.json', {'status': '200'})
api_key = 'your_api_key'
service = build('books', 'v1', http=http, developerKey=api_key)
request = service.volumes().list(source='public', q='android')
http = HttpMock('books-android.json', {'status': '200'})
response = request.execute(http=http)
pprint.pprint(response)

这里有一个图书发现json返回值here的示例。你知道吗

如何生成或获取discovery Calendar API V3的响应json?你知道吗


Tags: keyfromimportbuildapijsonhttpstatus