avanza
avanza copied to clipboard
get_insights_report method fail when using different time periods
Setup versions
avanza-api==8.0.0
python==3.11
The following piece of code works
avanza.get_insights_report(
account_id=account_id,
time_period=TimePeriod.ONE_WEEK
)
But When used with other time_periods
likeTimePeriod.ONE_MONTH
, TimePeriod.THREE_MONTHS
, the request fails.
insights_report = avanza.get_insights_report(
account_id=account_id,
time_period=TimePeriod.ONE_MONTH
)
Error log
Traceback (most recent call last):
File "/workspaces/avanza/src/example_avanza.py", line 27, in <module>
insights_report = avanza.get_insights_report(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/avanza/avanza.py", line 1483, in get_insights_report
return self.__call(
^^^^^^^^^^^^
File "/home/vscode/.local/lib/python3.11/site-packages/avanza/avanza.py", line 139, in __call
response.raise_for_status()
File "/home/vscode/.local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://www.avanza.se/_api/insights-development/?timePeriod=ONE_MONTH&accountIds=1234567