0

I am trying to get the freebase search API to work in python, and I ran the code exactly as laid out on the freebase api website here, which uses urllib.urlopen(url). However I consistently get the following error:

Traceback (most recent call last):

  File ".../FreebaseExtractor.py", line 63, in <module>
    response = json.loads(urllib.urlopen(url).read())
  File "...\Anaconda\lib\urllib.py", line 87, in urlopen
    return opener.open(url)
  File "...\Anaconda\lib\urllib.py", line 213, in open
    return getattr(self, name)(url)
  File "...\Anaconda\lib\urllib.py", line 443, in open_https
    h.endheaders(data)
  File "...\Anaconda\lib\httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "...\Anaconda\lib\httplib.py", line 893, in _send_output
    self.send(msg)
  File "...\Anaconda\lib\httplib.py", line 855, in send
    self.connect()
  File "...\Anaconda\lib\httplib.py", line 1274, in connect
    server_hostname=server_hostname)
  File "...\Anaconda\lib\ssl.py", line 352, in wrap_socket
    _context=self)
  File "...\Anaconda\lib\ssl.py", line 579, in __init__
    self.do_handshake()
  File "...\Anaconda\lib\ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
IOError: [Errno socket error] EOF occurred in violation of protocol (_ssl.c:590)

I have tried using urllib2 to create a request object and changing my User-Agent header, as well as using the request module instead of urllib, but neither of those work either. I know it isn't my API key problem or that the freebase API is totally shut down now because the code (using my API key) works just fine on a friend's python setup. Anyone have any thoughts on this?

I currently use python 2.7.10, Anaconda 2.3.0 (64-bit), and I have been using pycharm.

Tin-Yun Ho
  • 36
  • 1

0 Answers0