扫码关注官方订阅号
GET /api/accounts HTTP/1.1 Content-Type: application/json X-Access-Token: username:token
这种 API,Python 要怎么调用啊??POST 登录生成 token 以后要怎么调用啊??? 求告知
闭关修行中......
import requests token = '从你存储的地方取值' headers = { 'Content-Type': 'application/json', 'X-Access-Token': 'username:{0}'.format(token) } r = request.get('/api/accounts', headers=headers) print r.text
把获得的token保存在本地,每次请求的时候带上token就好了
import requests
r = requests.get(url)
import requestsr = requests.get(url, cookies=cookies)
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
把获得的token保存在本地,每次请求的时候带上token就好了
import requests
r = requests.get(url)
import requests
r = requests.get(url, cookies=cookies)