-
響應基本API
查看全部 -
Hyper Text Transfer Protocol(簡稱HTTP)超文本傳輸協議
查看全部 -
Session:?
-? 服務器端存儲
Cookie:
- 客戶端存儲
? ? cookies=dict(c=requests.get(url).cookies['cookiename'])
? ? ?requests.get(url,cookies=cookies)
查看全部 -
proxy
? response = requests.get(url, proxies=proxies)
查看全部 -
- Base Auth
? Basic:? ?base64.b64decode('xxxxxxxxx')
- OAuth
? ?headers={'Authorization': 'token xxxxxxxxxxxxxxxx'}
? ? from requests.auth import AuthBase
? ? ?class GithubAuth(AuthBase):
? ? ? ? ? ? def __init__(self. token):
? ? ??????????????self.token = token
?????????????def __call__(self,r):
? ??????????????????r.headers['Authorization'] = ''.join(['token',self.token])
????????????????????return r?
查看全部 -
def? m_hook_fun()
? ?response.headers['Content-Type']
def main()
? requests.get(url,hooks=dict(response=m_hook_fun))
查看全部 -
response = requests.get(url, headers=headers, stream=True)
#with closing(requests.get(Jurl,xxx)as response:
with open( 'xxx.jpg', 'wb') as fd:
????for chunk in response.iter_content(123):
? ? ?fd.write(chunk)
查看全部 -
from requests import Request,Session
查看全部 -
response.raise_for_status()
查看全部 -
帶參數的請求
- URL Parameters: URL參數
? request.get(url,params={'key':'value'})
- 表單參數
? ?Content-Type: application/x-www-form-urlencoded
? ?request.post(url,data={'key':'value'})
- Json參數提交
? Content-Type:application/json
? requests.post(url,json={'key':'value'})
查看全部 -
GET
POST
PUT
PATCH
DELETE
HEAD
OPTIONS
查看全部 -
gunicorn httpbin
gunicorn httpbin:app
查看全部 -
windows10安裝gunicorn,httpbin。
啟動 gunicorn?? httpbin:app
報錯:ModuleNotFoundError: No module named 'pwd'
原因: gunicorn不支持Windows系統。
查看全部 -
requests下載圖片
查看全部 -
response content text json 字符串,unicode,json查看全部
舉報