Hi,

I am using Ubuntu 12.10 and squid3
I followed http://dabase.com/blog/Minimal_squid3_proxy_configuration/ to 
setup proxy server.
I tested proxy server with firefox with IP:127.0.0.1 and Port:3128 and it 
working (asking for proxy username and password).

But, i could not make http connection through proxy server requiring 
authentication using following python code..

*########## Python code ########## *

import urllib2
proxy = 
urllib2.ProxyHandler({'http':'http://saju:123@saju-Inspiron-N5010:3128'})
opener = urllib2.build_opener(proxy, urllib2.HTTPHandler)
urllib2.install_opener(opener)

conn = urllib2.urlopen('http://python.org')
return_str = conn.read()
print "===return_st====", return_str


*==== ERROR ====*

Traceback (most recent call last):
  File "my_proxy.py", line 6, in <module>
    conn = urllib2.urlopen('http://python.org')
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 407, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 445, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 407: Proxy Authentication Required



*########## Proxy Server Settings ########## *

sudo vim /etc/squid3/squid.conf
-------------------------------
auth_param digest program /usr/lib/squid3/digest_pw_auth -c 
/etc/squid3/passwords
auth_param digest realm saju-Inspiron-N5010
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_port 3128

*Setting up user
--------------*

htdigest -c /etc/squid3/passwords saju-Inspiron-N5010 saju

==============================


attached squid.conf also


Thanks,



-- 
-- 
"Freedom is the only law". 
"Freedom Unplugged"
http://www.ilug-tvm.org

You received this message because you are subscribed to the Google
Groups "ilug-tvm" group.
To control your subscription visit 
http://groups.google.co.in/group/ilug-tvm/subscribe
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]



For details visit the google group page: 
http://groups.google.com/group/ilug-tvm?hl=en



Reply via email to