March 13, 2008

How to run feedparser behind proxy

So, I had to change the feedparser code to run it behind proxy. Basically the idea is that python by default doesn’t user environment variables http proxy. You have to specify it in the python code.

In feedparser code, url is accessed at the line # 1895. Now, opener has to have http settings so that it could access the url. For that, I added 2 lines before calling opener:

proxy_support = urllib2.ProxyHandler({"http" : "http://<username>:<passwd>@<proxyserver>:<proxyport>"});
opener = urllib2.build_opener(proxy_support)

Here is the final feedparser : FeedParser With Proxy Support

Filed under: FeedParser, Proxy, Python — 12:12 pm

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Valid XHTML 1.0 Transitional Valid CSS! Creative Commons License Blog Powered By wordpress Wiki Powered By dokuwiki