阅读背景:

python发送post数据

来源:互联网 
import http.client,urllib.parse
host = 'iflying.sinaapp.com'  #主机域名
path = '/test.php'  #资源名
params = urllib.parse.urlencode({   #要传送的数据
	'username':'Tom',
	'password':'123'
	})
headers = {"Content-Type":"application/x-www-form-urlencoded","Accept":"text/plain"}   #头信息
conn = http.client.HTTPConnection(host)
conn.request('POST',path,params,headers)
response = conn.getresponse()
print(response.read())
conn.close()
import http.client,urllib.parse
host = 'iflying



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: