RedWarrior
RedWarrior

Reputation: 31

Urllib2 Send Post data through proxy

I have configured a proxy using proxyhandler and sent a request with some POST data:

cookiejar = cookielib.CookieJar()
proxies = {'http':'http://some-proxy:port/'}
opener = urllib2.build_opener(urllib2.ProxyHandler(proxies),urllib2.HTTPCookieProcessor(cookiejar) ) 
opener.addheaders = [('User-agent', "USER AGENT")]
urllib2.install_opener(opener) 
url = "URL" 
opener.open(url, urllib.urlencode({"DATA1":"DATA1"}))

then I get a 405 http error (Method not allowed)

may I get some assistance? I cannot figure out what is going wrong

Thanks in advance

Upvotes: 2

Views: 2603

Answers (1)

RedWarrior
RedWarrior

Reputation: 31

The problem was user-agent header.

Upvotes: 1

Related Questions