我正在尝试使用Google Calendar API v3调试我的界面。我在python中编写代码并使用我能找到的API示例。我想确保我正在向API发送正确的html字符串。我看到代码是如何构建字符串和插入参数的,但我不知道在execute()
命令中发送的实际字符串是什么。
有没有办法打印发送而不是执行的html字符串?请举例。
http = httplib2.Http(cache=".cache")
http = credentials.authorize(http)
service = build("moderator", "v1", http=http)
series_body = {
"description": "Share and rank tips for eating healthy and cheap!",
"name": "Eating Healthy & Cheap",
"videoSubmissionAllowed": False
}
# How Do I print the string rather than execute?
series = service.series().insert(body=series_body).execute()
print "Created a new series"
答案 0 :(得分:1)
您可以设置httplib2.debuglevel = 4
在stdout上打印标题和请求/响应正文:
http://code.google.com/p/google-api-python-client/wiki/Debugging