requests 简单用法
'''
Get function
'''
payload = {'key1': 'value1', 'key2': 'value2'}
r = requests.get("http://httpbin.org/get", params=payload)
print(r.text)
# 如果返回信息是json
print(r.json())
'''
POST function
'''
r = requests.post('http://httpbin.org/post', data = {'key':'value'})
'''
header
'''
headers = {'user-agent': 'my-app/0.0.1'}
r = requests.get(url, headers=headers)
'''
cookie
'''
cookies = dict(cookies_are='working')
r = requests.get(url, cookies=cookies)