首页 > 代码库 > Python模拟http请求

Python模拟http请求

 1 #-*-coding:utf-8-*- 2 import urllib, urllib2 3 url = "http://www.love-sysu.com/cloud" 4 data =http://www.mamicode.com/ { 5     "name":"张小三", 6     "id":"12353032" 7 } 8 para = urllib.urlencode(data) 9 res = urllib2.urlopen(url+?+para)10 print res.read()11 12 #url = "http://www.love-sysu.com/cloud?name=zengzhaoyang&id=12353255"13 #res = urllib2.urlopen(url)14 #print res.read()

 

Python模拟http请求