title: Can't connect to tor website through python
body: <p>I want to parse an onion website with python, came up with that code:</p>
  
  <pre><code>import requests
  
  proxies = {
      'http': 'socks5://localhost:9150',
      'https': 'socks5://localhost:9150'
  }
  url = 'http://sblib3fk2gryb46d.onion'
  
  print(requests.get(url, proxies=proxies).text)
  </code></pre>
  
  <p>Gives me an error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socks.py", line 851, in connect
      negotiate(self, dest_addr, dest_port)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socks.py", line 497, in _negotiate_SOCKS5
      self, CONNECT, dest_addr)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socks.py", line 565, in _SOCKS5_request
      resolved = self._write_SOCKS5_address(dst, writer)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socks.py", line 621, in _write_SOCKS5_address
      socket.AI_ADDRCONFIG)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 743, in getaddrinfo
      for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno 8] nodename nor servname provided, or not known
  </code></pre>
  
  <p>Works just fine with clearnet websites. Tor is opened, I use mac os. 
  I've tried a few various options, this one is the only one that is working so far(at least i managed to connect through tor to clearnet)</p>
  
  <p>Maybe someone did smth like that before and can help?</p>