python爬虫之requests
基本 GET 请求
requrests.get(url)
# 添加参数
requests.get(url,params=payload)
基本 POST 请求
requests.post(url,data=payload)
其他类型的请求
r = requests.put(url) r = requests.delete(url) r = requests.head(url) r = requests.options(url)
添加 header
requests.get(url,headers=headers)
添加 cookies
requests.get(url,cookies=cookies)
设置超时(s)
requests.get(url,timeout=30)