python接口自動化(put請求)python
1、put請求的做用:更新資源json
2、應用app
import requests import requests #2.調用post方法 #請求的URL url='https://www.*******/pc/member/sign/' #請求頭 headers={'content-type':'application/x-www-form-urlencoded'} #請求的參數 data={'flag': 'mobile', 'password': 'e9f5c5240c0bb39488e6dbfbdb1517e0', 'mobile_phone':'*******'} r=requests.put(url,data=data,headers=headers) #3.獲取響應對象 print(r.text)#文本格式 print(r.json())#json格式 #4.獲取響應狀態碼 print(r.status_code) #5.請求的URL print(r.url)