Python向服务器Post数据(可…

原文地址:Python向服务器Post数据(可实现自动登录) 作者:woodstone121
Python向服务器Post数据(可实现自动登录)
2009-04-08 16:05
# -*- coding: cp936 -*-
import httplib
import urllib
user='aaa'
params=urllib.urlencode({"Text1":user})
headers={"Accept":"text/html","User-Agent":"IE","Content-Type":"application/x-www-form-urlencoded"}
website="localhost:1483"
path="/abc/(S(drixqpzt15p2dpepy5xk1enq))/Default.aspx"
conn=httplib.HTTPConnection(website)
conn.request("POST",path,params,headers)
r=conn.getresponse()
print r.status,r.reason
data=r.read()
print data
conn.close()

你可能感兴趣的:(Python)