How do I make calls to AWS with Python 3 and httplib2 on Windows 7?

隐身守侯 提交于 2020-02-02 02:22:11

问题


I am using httplib2 to make calls to Amazon Web Services (AWS):

http = httplib2.Http(cache='.cache')
response, content = http.request('https://sdb.amazonaws.com/...')

However it fails looking for CAs (I think):

File "C:\Python32\lib\site-packages\httplib2\__init__.py", line 1059, in request self.disable_ssl_certificate_validation)
File "C:\Python32\lib\site-packages\httplib2\__init__.py", line 772, in __init__ context.load_verify_locations(ca_certs)
IOError: [Errno 2] No such file or directory

My questions:

  1. Is there something I need to do to configure my OS and environment for this to work?
  2. I've seen a lot of posts about making sure the sockets library is built for SSL in Python 2; does that apply to Python 3?

Thanks!


回答1:


The httplib2 /Python3 folder is missing cacerts.txt, so it doesn't get copied to the Python /lib folder. I copied the file there manually and everything worked. This is a known issue with httplib2.




回答2:


I know late to the game but my issue was related to a bad PYTHONPATH command in my bash profile and thus the directory was being put in the incorrect location.

Solution was to remove the PYTHONPATH command in my bash profile and voila.



来源:https://stackoverflow.com/questions/7043756/how-do-i-make-calls-to-aws-with-python-3-and-httplib2-on-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!