我正在尝试使用 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"
最佳答案
您可以设置 httplib2.debuglevel = 4
以在 stdout 上打印出 header 和请求/响应主体:
http://code.google.com/p/google-api-python-client/wiki/Debugging
关于python - 如何调试 Python Google API 接口(interface)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10694597/