-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
In the Reports API, Clockify accepts the "exportType" payload field which can have, apart from JSON, response in CSV, PDF or XLSX format. Since AbstractClockify class' methods always parses to JSON, it is impossible to retrieve the raw binary data of the exported report.
Possible solution: Add optional arguments in (some) methods to make the Clockify class methods return the raw response object.
Example:
REPORT_OPTS = {
"dateRangeStart": "2022-06-28T00:00:00.000",
"dateRangeEnd": "2022-07-02T23:59:59.000",
"summaryFilter": {
"groups": [
"USER",
"PROJECT",
"TIMEENTRY"
],
"sortColumn": "GROUP"
},
"exportType": "PDF"
}
client = ClockifyAPIClient().build(API_KEY, API_URL)
print(client.reports.get_summary_report(CLOCKIFY_WORKSPACE_ID, REPORT_OPTS))Output:
ERROR:root:API error: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "...", line 30, in <module>
print(client.reports.get_summary_report(CLOCKIFY_WORKSPACE, REPORT_OPTS))
File "C:\Users\[]\AppData\Local\Programs\Python\Python39\lib\site-packages\clockify_api_client\models\report.py", line 22, in get_summary_report
raise e
File "C:\Users\[]\AppData\Local\Programs\Python\Python39\lib\site-packages\clockify_api_client\models\report.py", line 19, in get_summary_report
return self.post(url, payload)
File "C:\Users\[]\AppData\Local\Programs\Python\Python39\lib\site-packages\clockify_api_client\abstract_clockify.py",
line 22, in post
return response.json()
File "C:\Users\[]\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
...snip...
File "C:\Users\[]\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels