Openshift python requests proxy permission denied
Question: I'm trying to use a proxy with the python 'requests' package on an Openshift
server. I am getting a permission denied error. See below.

Is Openshift blocking the connection or am I not configuring it correctly?
Something else? Openshift doesn't want to let me connect to a proxy because
the code works fine locally and on Heroku.

**Code**

    
    
    from ssl import PROTOCOL_TLSv1
    import ssladapter
    
    proxies = {'https': 'http://{}:{}@96.44.147.34:6060'.format(CFG.proxy_username, CFG.proxy_password)}
    
    url1 = 'https://reservaciones.volaris.com/Flight/DeepLinkSearch'                    
    
    session = requests.Session()
    session.mount('https://', ssladapter.SSLAdapter(ssl_version=PROTOCOL_TLSv1))
    
    request1 = session.get(url1, proxies=proxies)   
    

**Traceback**

    
    
    requests.exceptions.ProxyError: HTTPSConnectionPool(host='reservaciones.volaris.com', port=443): Max retries exceeded with url: /Flight/DeepLinkSearch (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f4e78386ad0>: Failed to establish a new connection: [Errno 13] Permission denied',)))
    


Answer: Most probably OpenShift blocks uncommon outgoing ports for [security
reasons](http://security.stackexchange.com/questions/24310/why-block-outgoing-
network-traffic-with-a-firewall). your proxy is listening on 6060. You should
try to ssh into your gear and try `telnet`

In my gear, post 6060 is blocked. See the attached screenshot.
[portquiz](http://portquiz.net/) listens on all TCP ports.

[![enter image description
here](http://i.stack.imgur.com/tdBWP.png)](http://i.stack.imgur.com/tdBWP.png)

