-
get:查看资源 post:增加资源 put:修改资源 delete:删除资源 head:查看响应头 options:查看可用请求方法查看全部
-
http 协议查看全部
-
老师的环境查看全部
-
咕嘟咕嘟闪光灯符合三分查看全部
-
https://github.com/jian-en/imooc-requests.git查看全部
-
HTTP协议查看全部
-
curl -v http://www.imooc.com > temp.txt查看全部
-
文件128查看全部
-
参数 啊啊查看全部
-
#使用urllib URL_IP = 'http://httpbin.org/ip' URL_GET = 'http://httpbin.org/get' import requests def use_simple_urllib2(): response = requests.get(URL_IP) print('>>>>>Response Headders:') print(response.headers) print('>>>>Response Body:') print (response.text) def use_params(): params ={'param1':'hello','param2':'world'} print('request params') print(params) response=requests.get(URL_GET,params=params) print('>>>>Response Headers:') print(response.headers) print ('>>>>Response Staus:') print(response.status_code) print(response.reason) print('>>>>Response Body:') print(response.text) if __name__ == '__main__': print('>>>>use Simple requests') #use_simple_urllib2() use_params() #构建请求参数 #发送请求 #处理响应查看全部
-
python3 形式: #使用urllib URL_IP = 'http://httpbin.org/ip' URL_GET = 'http://httpbin.org/get' import urllib from urllib import request import urllib.parse def use_simple_urllib2(): response = request.urlopen(URL_IP) print('>>>>>Response Headders:') print(response.info()) print('>>>>Response Body:') print (response.read().decode()) def use_params(): params =urllib.parse.urlencode({'param1':'hello',\ 'param2':'world'}) print('request params') print(params) response=request.urlopen(URL_GET+'?'+params) print(URL_GET+params) print('>>>>Response Headers:') print(response.info()) print ('>>>>Response Staus:') print(response.getcode()) print('>>>>Response Body:') print(response.read().decode()) if __name__ == '__main__': # print('>>>>use Simple urllib') # use_simple_urllib2() use_params() #构建请求参数 #发送请求 #处理响应查看全部
-
urllib,urllib2,urllib3查看全部
-
requests.Session()查看全部
-
HTTP协议查看全部
-
http://httpbin.org/查看全部
举报
0/150
提交
取消