title: proxy connection error with tinyproxy
body: <p>My first post/question to stackoverflow, please bear with me.</p>
  
  <p><strong>Project/Objective:</strong><br>
  I have a python script on pythonanywhere which uses an API get request which requires an ip specific key.  However, when the script is run from pythonanywhere, the ip is dynamic.  I am able to work around using an open proxy server and specifying the proxy server's ip in the request header and generating the API key with the proxy server's ip.  I thought a better solution would be to set up a proxy server of my own at home.</p>
  
  <p><strong>Attempted Solution:</strong><br>
  Running tinyproxy on ubuntu 16.04 behind a router with port forwarding set on 8888 to the internal ip of the ubuntu machine.<br>
  tinyproxy config settings as follows:<br>
  Port 8888<br>
  ConnectPort 443<br>
  ConnectPort 563<br>
  Allow 127.0.0.1<br>
  Allow xx.xx.xx.xx (my external ip)<br>
  Allow 192.168..0.0/16  </p>
  
  <p><strong>Sample Code:</strong>  </p>
  
  <pre><code>import requests
  proxy_ip = 'xx.xx.xx.xx:8888' # my external ip
  proxy = {
      'http': proxy_ip,
      'https': proxy_ip
      }
  r = requests.get('https://api.ipify.org',params={'format': 'json'},proxies=proxy)
  my_proxied_ip = r.json()['ip']
  print('my proxied ip: ' + my_proxied_ip)
  </code></pre>
  
  <p><strong>Problem:</strong><br>
  If I use a known open proxy ip:port... works fine.<br>
  If I xx.xx.xx.xx:8888... I get:<br>
  requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.ipify.org', port=443): Max retries exceeded with url: /?format=json (Caused 
  by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Access denied',)))  </p>
  
  <p><strong>Question:</strong><br>
  I am striking out with troubleshooting... seems like it's a problem with the proxy server (tinyproxy) settings.  Or is there something else I'm missing?  Or a better solution / workaround?</p>