python 爬蟲 (2)request-post
阿新 • • 發佈:2018-12-13
import requests #使用data引數傳遞post引數 # datas = {'user':'aaaa','pwd':'123'} # re = requests.post('http://httpbin.org/post',data = datas) # print(re.text) #傳送 cookie # re = requests.post('http://httpbin.org/post',cookies = datas) # print(re.text)
#
#上傳檔案 # files = {'file':open('b.txt','rb')} # re = requests.post('http://httpbin.org/post',files = files) # print(re.text)
#上傳json資料 # import json # url = 'http://httpbin.org/post' # url = 'http://www.mywebs.com/re_json' # datas = {'id':'111','name':'joe'} # print(type(datas))
# print(type(json.dumps(datas))) # re = requests.post(url,data = json.dumps(datas)) # print(re.text)
還有 一些沒有寫完 ////。。。。以後更新 #超時操作#session模擬登陸 SSL驗證 代理