Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'url:pypi': 0.03; '(at': 0.04; 'subject:Python': 0.06; 'stops': 0.07; 'git': 0.09; 'http': 0.09; 'python': 0.11; '407': 0.16; 'clone': 0.16; 'fetch': 0.16; 'fine.': 0.16; 'forefront': 0.16; 'proxy,': 0.16; 'tried:': 0.16; 'url:example': 0.16; 'urllib2,': 0.16; 'index': 0.16; 'entered': 0.20; 'example': 0.22; 'import': 0.22; 'print': 0.22; 'install': 0.23; 'error': 0.23; 'config': 0.24; 'example.': 0.24; 'proxy': 0.24; 'least': 0.26; 'values': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'getting': 0.31; 'requests': 0.31; 'that.': 0.31; 'run': 0.32; 'url:python': 0.33; 'url:non-standard http port': 0.33; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'url:org': 0.36; 'filter': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'to:addr:python.org': 0.39; 'ago.': 0.61; 'information': 0.63; 'our': 0.64; 'connecting': 0.64; 'fulfill': 0.68; 'request.': 0.70; 'frustrating': 0.84; 'url:proxy': 0.84; 'imagine': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=AFKv3F+4Gpx2I5RX4jlDkXgByR25PiqHakwjdwAdAfo=; b=TFlEvI7cWxIntKWsybzwEKUErzWEt4/Z54SIteNwSM97GuvugLPP6OYrSS/4d9doRC R88lUEdbq/kLgUFanqqpvRmYcXD5VQlxdYlVQshaOzSLU+t0jWKhUDF+shtl3Hl3FbJQ wsIDuBLPH9Ik+g78HGdIlfrFwNRtDUZH14AT8PWS13cXIkIEttigBuIkO5fyfmnKxO2D SEqixTaFqqlnBnM6Zby8tusGQ0yWy+GDoOSRmkEAOKlaVaLPO//wpogvA9cj//zFDgmu /H6Ca3ObzPHekapmNOZYfxrxxpQlY5lFwGBG4WDRcQFxBqx/FzdX6b5LSX/hQ5Wful/7 7svw== MIME-Version: 1.0 X-Received: by 10.58.234.134 with SMTP id ue6mr883222vec.20.1372208060317; Tue, 25 Jun 2013 17:54:20 -0700 (PDT) Date: Wed, 26 Jun 2013 12:54:20 +1200 Subject: Proxy connection with Python From: bevan jenkins To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372208062 news.xs4all.nl 15891 [2001:888:2000:d::a6]:53255 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49219 Hello, I have an issue that has been frustrating me for a while now. This is an update of a crosspost (http://stackoverflow.com/questions/16703936/proxy-connection-with-python) which I made over a month ago. I have been attempting to connect to URLs from python. I have tried: urllib2, urlib3, and requests. It is the same issue that i run up against in all cases. Once I get the answer I imagine all three of them would work fine. The issue is connecting via proxy. I have entered our proxy information but am not getting any joy. I am getting 407 codes and error messages like: HTTP Error 407: Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. ) I think that this also stops me using pip to install (at least from remotes ). I get 'Cannot fetch index base URL http://pypi.python.org/simple/". I end up using git to clone a local copy of the repo and install from that. However, I can connect using a number of other applications that go through the proxy, git and pycharm for example. When I run git config --get htpp.proxy it returns the same values and format that I am entering in Python namely: http://username:password@proxy:8080 An example of code in requests is import requests proxy = {"http": "http://username:password@proxy:8080"} url = 'http://example.org' r = requests.get(url, proxies=proxy) print r.status_code Thanks for your time and any suggestions gratefully received.