params的时候之间接把参数加到url后面,只在get请求时使用:
1 import requests 2 url='https://api.ireaderm.net/account/charge/info/android' 3 data={'recharge':36,'fee_id':'ireader_nonrenew_vip'} 4 header={ 5 'X-ZY-Timestamp':'1502097587609', 6 'X-ZY-Sign':'xxxxxxxxxxxxxxxxxxxxxxxxxxx', 7 'X-ZY-Client':'xxxxxxxxxxxxxxxxxxxxxx' 8 } 9 res=requests.get(url,params=data,headers=header) 10 print(res.text)
1 import requests 2 url='https://api.ireaderm.net/account/charge/info/android?recharge=36&fee_id=ireader_nonrenew_vip_1_fee_usd_1m3d99' 3 header={ 4 'X-ZY-Timestamp':'1502097587609', 5 'X-ZY-Sign':'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 6 'X-ZY-Client':'xxxxxxxxxxxxxxxxxxxxxxxxxxxx' 7 8 } 9 res=requests.get(url,headers=header) 10 print(res.text)
data用于post请求时: