Last updated 5 years ago
Was this helpful?
1.requests module
methods
reuests.get
reuests.post
reuests.put
reuests.delete
HTTP狀態碼:
REST API
2.Install request module
git clone git://github.com/kennethreitz/requests.git python setup.py install
3.GET
1.發送請求
響應內容, JSON響應內容, 狀態碼
2.在header中加入參數
import requests url = 'http://10.144.5.183/api/v1/devices' t = '$2a$10$RqOyphofSoIOwO8mbhEXfOYIX7ZkjrFUyrEPsJ4yzRzvRq/u' h = {'api-token': t} r = requests.get(url, headers=h) print r.text