Pixela Graph 未接收给定的参数?

问题描述 投票:0回答:1
import requests
USERNAME="username"
TOKEN="token"
pixela_endpoint = ("https://pixe.la/v1/users")

params={
    "token":TOKEN,
    "username": USERNAME,
    "agreeTermsOfService": "yes",
    "notMinor": "yes",
}




graph_endpoint=f"{pixela_endpoint}/{USERNAME}/graphs"

graph_params={
    "id": "graph1",
    "name": "Working Graph",
    "unit": "H",
    "type": "float",
    "color ": "momiji"
}
headers={
    "X-USER-TOKEN": TOKEN
}
response_graph=requests.post(url=graph_endpoint,json=graph_params,headers=headers)
print(response_graph.text)

基本上我正在构建像素图,每当我运行此代码时,我都会收到此消息。 (已经注册了,但是第二部分代码好像有问题)

{"message":"It is necessary to specify id, name, unit, type, and color params.","isSuccess":false}

有谁知道答案吗

python python-2.7 python-decorators
1个回答
0
投票

这是因为您在图形参数中为键指定了错误的值。端点也可能是错误的。

© www.soinside.com 2019 - 2024. All rights reserved.