10

如何从 boto 中获得有用的诊断信息?我似乎得到的只是无用的“400 Bad Request”。我认识到 boto 只是传递了底层 API 提供的东西,但肯定有一些方法可以获得比“错误请求”更有用的东西。

Traceback (most recent call last):
  File "./mongo_pulldown.py", line 153, in <module>
    main()
  File "./mongo_pulldown.py", line 24, in main
    print "snap = %r" % snap
  File "./mongo_pulldown.py", line 149, in __exit__
    self.connection.delete_volume(self.volume.id)
  File "/home/roy/deploy/current/python/local/lib/python2.7/site-packages/boto/ec2/connection.py", line 1507, in delete_volume
    return self.get_status('DeleteVolume', params, verb='POST')
  File "/home/roy/deploy/current/python/local/lib/python2.7/site-packages/boto/connection.py", line 985, in get_status
    raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
4

2 回答 2

8

您可以将 boto.cfg文件配置为更详细:

[Boto]
debug = 2

debug:控制将由 boto 库打印的调试消息的级别。定义了以下值:

0 - no debug messages are printed
1 - basic debug messages from boto are printed
2 - all boto debugging messages plus request/response messages from httplib
于 2013-06-21T06:59:25.800 回答
8

将调试设置放在配置文件中我没有太多运气,但是对 ec2.connect_to_region() 的调用需要一个调试参数,其值与 j0nes 的答案中的值相同。

ec2 = boto.ec2.connect_to_region("eu-west-1", debug=2)

连接对象发送/接收的所有内容都将转储到标准输出。

于 2014-01-16T14:11:31.890 回答