Requests
来自维基百科,自由的百科全书
Requests是一個Python HTTP庫,在Apache License 2.0 許可證下發行。這個專案的目標是使HTTP請求更簡單,更人性化。Requests是沒有預設包含在Python內的最流行的Python庫之一[2],因此有人建議將其預設隨Python一起發佈[3]。
範例代碼
>>> import requests
>>> r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass'))
>>> r.status_code
200
>>> r.headers['content-type']
'application/json; charset=utf8'
>>> r.encoding
'utf-8'
>>> r.text
'{"authenticated": true, ...'
>>> r.json()
{'authenticated': True, ...}
參照
外部連結
Wikiwand - on
Seamless Wikipedia browsing. On steroids.