6

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!

Seth
  • 6,514
  • 5
  • 49
  • 58
  • SOLVED: The httplib2 setup script for Python 3 does not copy `cacerts.txt` to Python's lib folder. I copied the folder manually, and everything worked. – Seth Aug 12 '11 at 18:11
  • 3
    If you solve your own problem you should not change the title, but post your solution as an answer and later mark it as accepted. This will help people who search for the same question, and may get you a few upvotes. – Dour High Arch Aug 12 '11 at 18:19

3 Answers3

5

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.

Seth
  • 6,514
  • 5
  • 49
  • 58
  • I found I had no `cacerts.txt` file on my Ubuntu system. I pulled a copy from [here](http://httplib2.googlecode.com/hg-history/6525cadfde53279479533c1235e2661f5c147afc/python2/httplib2/cacerts.txt) and saved it in the `httplib2` directory. Run `python -c "import httplib2;print httplib2.__file__"` to find out where your `httplib2` directory is. – David Oct 03 '11 at 22:42
0

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.

captnolimar
  • 97
  • 1
  • 9
0

I spent hours trying to figure this out and finally I have an answer. This can happen on Windows if the certificate (CA) file is blocked if you downloaded it from another source or computer. Right click on the cert file and check the "unblock" box.