課程
/后端開發
/Python
/Python-走進Requests庫
有誰嘗試使用delete嗎,我做過實驗,總是不成功啊,老師有試試嗎?
2017-10-01
源自:Python-走進Requests庫 3-2
正在回答
Python 3.6.2 下的代碼供參考
def?request_get(): ????response?=?requests.get(build_uri('user/emails'), ????????????????????????????auth=('imoocdemo',?'imoocdemo123')) ????print(better_print(response.text)) ????print(response.request.headers) ????print(response.status_code) def?request_method(): ????response?=?requests.delete(build_uri('user/emails'), ???????????????????????????????auth=('imoocdemo',?'imoocdemo123'), ???????????????????????????????json=['[email protected]']) ????print(better_print(response.text)) ????print(response.request.headers) ????print(response.request.body) ????print(response.status_code) if?__name__?==?'__main__': ????request_method() ????request_get()
先只運行 request_get() 獲取郵箱地址列表,把最后一個郵箱地址替換到 request_method() 的 json 里,再運行 request_method() 和 request_get() 查看結果
慕粉4306504 提問者
舉報
python類庫中,requests是一件利器,想深入了解一起來學吧
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-10-10
Python 3.6.2 下的代碼供參考
先只運行 request_get() 獲取郵箱地址列表,把最后一個郵箱地址替換到 request_method() 的 json 里,再運行 request_method() 和 request_get() 查看結果