Skip to content

API上传接口权限问题 #508

Answered by lzkgbld
lzkgbld asked this question in 问答
Discussion options

You must be logged in to vote

抱歉因为我的问题并没有看到token标头需要携带Bearer,所以导致一直无法通过身份验证。
附赠一下代码:

headers = {
        'Authorization': 'Bearer '+你的token,
        'Accept': 'application/json',
    }
data = {
        'file': open('图片地址', 'rb')
    }
data = requests.post(你的API URL 地址+'upload', files=data, headers=headers)
# 获取图片地址
data.json()['data']['links']['url']

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lzkgbld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
问答
Labels
None yet
1 participant