urllib2 python exception in Ubuntu when loading a https json file
Question: I'm trying to load a json file but it's throwing an exception:

    
    
    <urlopen error [Errno 104] Connection reset by peer>
    

This is my code (I executed it on the shell for testing/debugging purposes):

    
    
    >>> import urllib2
    >>> uri = 'https://api.mercadolibre.com/sites/MLA/search?q=camisas%20columbia'
    >>> req = urllib2.Request(uri)
    >>> resp = urllib2.urlopen(req)
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
      File "/opt/bitnami/python/lib/python2.7/urllib2.py", line 126, in urlopen
        return _opener.open(url, data, timeout)
      File "/opt/bitnami/python/lib/python2.7/urllib2.py", line 400, in open
        response = self._open(req, data)
      File "/opt/bitnami/python/lib/python2.7/urllib2.py", line 418, in _open
        '_open', req)
      File "/opt/bitnami/python/lib/python2.7/urllib2.py", line 378, in _call_chain
        result = func(*args)
      File "/opt/bitnami/python/lib/python2.7/urllib2.py", line 1215, in https_open
        return self.do_open(httplib.HTTPSConnection, req)
      File "/opt/bitnami/python/lib/python2.7/urllib2.py", line 1177, in do_open
        raise URLError(err)
    URLError: <urlopen error [Errno 104] Connection reset by peer>
    

I'm using Ubuntu 12.04 (64-bit) Bitnami's Django Stack 1.4.3-0 virtualized on
VMWare.

But, I was curious and tried the same exact code in my host machine (Windows 7
64-bits) where I also have **THE SAME EXACT VERSION** of python installed and
guess what... it worked flawlessly.

Here's the windows output:

    
    
    C:\Users\Kevin>python
    Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import urllib2
    >>> uri = "https://api.mercadolibre.com/sites/MLA/search?q=camisas%20columbia"
    >>> req = urllib2.Request(uri)
    >>> resp = urllib2.urlopen(req)
    >>> resp.read()
    '{"site_id":"MLA","query":"camisas columbia","paging":    {"total":43,"offset":0,"limit":50},"results":    [{"id":"MLA445360462","site_id":"MLA","title":"Ca
    misa Columbia Silver Rider Hombre Tecnolog\xc3\xadas De Omni-dry" [...] 
    

How can I fix this issue in Ubuntu? I have tried changing the user agent and
stuff in the request but the result was always the same on Ubuntu.

Also tried manually copying the json file and uploaded it to dropbox and ran
the same code as above but with the dropbox url and it worked flawlessly on
both systems.

Hope you guys can help me, this is driving me crazy and my whole project
depends on that freaking api :(

Thanks in advance and sorry for my poor english.


Answer: I found the root of the issue:

<https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/965371>

