首页 > 解决方案 > 使用 Python 调用经过身份验证的 Beebole API

问题描述

所以我需要用 python 调用 beebole API。(文档https://beebole.com/timesheet-api/)。

我还想将调用保存在 csv/excel 文件中(但现在如果我能够使请求工作,已经是一大步了)

我正在尝试以下操作 - 使用服务 person.get 没有成功(我只收到消息 - 过程以代码 0 完成)

import requests
payload = {
    "service": "person.get",
    "id": user_ID
}
auth = {
    "username": "token",
    "password": "password"
}

url = "https://beebole-apps.com/api/v2"

req = requests.get(url, params=payload, auth=auth).json()

print(req)

标签: pythonapi

解决方案


如果你还没有解决它。这应该适合你:

import requests
payload = {
    "service": "person.get",
    "id": user_ID
}
auth = ("token", 'x')

url = "https://beebole-apps.com/api/v2"

req = requests.post(url, json=payload, auth=auth).json()

print(req)

推荐阅读