Requesting With Parameters

旧巷老猫 提交于 2021-01-29 09:16:56

问题


I'm doing some experiments with the Clockify API. It uses curl but I figured a way with python requests.

In the Time-Entry Section there's a optional parameter you can pass. Basically without this parameter the duration format of the time-entry show's up in letters and numbers. It's the "consider-duration-format" parameter btw.

I tried passing this parameter through

url = 'https://api.clockify.me/api/v1/workspaces/{workspaceID}/user/{userID}/time-entry
headers = {'X-Api-Key': 'my_api_key',
           'content-type': 'application/json'}
data = {'consider-duration-format': True}
req = requests.get(url, data=data, headers=headers)
print(req.json())

The duration format didn't change so then I tried params

params= {'consider-duration-format': True}
req = requests.get(url, params=params, headers=headers)
print(req.json())

And unfortunately it also didn't work.

来源:https://stackoverflow.com/questions/65725869/requesting-with-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!