atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.34k stars 661 forks source link

Invalid parameter name "from" in the Jira.tempo_4_timesheets_find_worklogs method #1273

Closed anttipalsola closed 10 months ago

anttipalsola commented 10 months ago

The parameter name from in the Jira.tempo_4_timesheets_find_worklogs method call (atlassian/jira.py:4118) causes a syntax error because from is a keyword in Python and thus cannot be used as parameter name:

>>> from atlassian import Jira
>>> j = Jira('https://localhost/')
>>> j.tempo_4_timesheets_find_worklogs(from='2023-01-01', to='2023-12-31')
  File "<stdin>", line 1
    j.tempo_4_timesheets_find_worklogs(from='2023-01-01', to='2023-12-31')
                                       ^^^^
SyntaxError: invalid syntax

The parameter needs to be renamed.

anttipalsola commented 10 months ago

There is a workaround: you can pass the arguments as a dict prefixed with double asterisk:

j.tempo_4_timesheets_find_worklogs(**{'from': '2023-01-01', 'to': '2023-12-31'})

However, I don't think the workaround is a very intuitive nor Pythonic, so I prefer the parameter to be renamed.