update requests

master
xianhu 2017-10-12 11:59:09 +08:00
parent 3541c71938
commit 0dac5d8cc3
1 changed files with 1 additions and 2 deletions

View File

@ -116,7 +116,7 @@ r = requests.get("http://example.com/some/cookie/setting/url")
print(r.cookies["example_cookie_name"]) # "example_cookie_value"
# 要想发送你的cookies到服务器, 可以使用cookies参数(一个字典)
cookies = dict(cookies_are="working")
cookies = {"cookies_are": "working"}
r = requests.get("http://httpbin.org/cookies", cookies=cookies)
print(r.text)
@ -207,7 +207,6 @@ requests.get("https://kennethreitz.com", cert="/wrong_path/server.pem")
with open("massive-body") as f:
requests.post("http://some.url/streamed", data=f)
# 事件挂钩, 可用的钩子: response(从一个请求产生的响应)
# 你可以通过传递一个 {hook_name: callback_function} 字典给 hooks 请求参数为每个请求分配一个钩子函数
def print_url(resp):