跟老齐学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)







posted @ 2018-07-05 21:06  duxiao123  阅读(1561)  评论(0编辑  收藏  举报