跟老齊學Python從入門到精通


http://www.itdiffer.com

http://www.1world0x00.com

 

 

import  requests
print(dir(requests))
r=requests.get("http://www.itdiffer.com")
print(r.cookies)
print(r.headers)
print(r.encoding)
print(r.status_code)
print(r.text)

---
請求發出后 requests會基於http頭部對應的編碼作出有根據的推測 當你訪問r.text requests使用其推測的文本編碼
能使用r.coding屬性來改變它
-----------
posts向服務器發送請求
----------

import  requests
payload={"key1":"val1","key2":"val2"}
r=requests.post("http://httpbin.org/post")
r1=requests.post("http://httpbin.org/post",data=payload)
print(r)
print("-----")
print(r1)








免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM