Kodi Community Forum

Full Version: How to connect to Internet via proxy server.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I found most of plugins don't support proxy connection.
just like this : response = urllib2.urlopen(req)
but in my company it does't work by this way .
I suggest someone who want to develop plugins consider about this issue, read netwrok connection information from XBMC.

I'm not familiar with python, so I just make a work around .
#################################
user='username'
password='password'
proxyserver='IP_addr:port'

proxy='http://%s:%s@%s' %(user,password,proxyserver)
proxy_handler=urllib2.ProxyHandler({'http':proxy})

opener=urllib2.build_opener(proxy_handler,urllib2.HTTPHandler)

#mark this line
#response = urllib2.urlopen(req)
response = opener.open(req)
Quote:I'm not familiar with python, so I just make a work around .
#################################
user='username'
password='password'
proxyserver='IP_addr:port'

proxy='http://%s:%s@%s' %(user,password,proxyserver)
proxy_handler=urllib2.ProxyHandler({'http':proxy})

opener=urllib2.build_opener(proxy_handler,urllib2.HTTPHandler)

#mark this line
#response = urllib2.urlopen(req)
response = opener.open(req)

How and where can I implement this work around