I am using urllib2 to send a http request, and the request ip is the machine ip where I send the request. but I want to change the request ip to be another one, what should I do?
import urllib2
tmp_url = "http://test.com/load?num=1"
tmp_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)"
tmp_refer = "http://a.test.com/"
tmp_header = {
'User-Agent' : tmp_agent,
'Referer' : tmp_refer
}
tmp_request = urllib2.Request(tmp_url, None, tmp_header)
tmp_result = urllib2.urlopen(tmp_request)
print tmp_result.read()
could you give me some suggestion? thank you very much!