Certain endpoints like `resolution` are returning 406 due to invalid accept headers
ksallee opened this issue · 4 comments
ksallee commented
Bug summary
Accept headers defined here: https://github.com/pycontribs/jira/blob/7846ac35a7e219dd3c1cd616a120a920f112b85e/jira/resilientsession.py#L145C9-L146C70
Seem to be invalid, because it should not be *.*
but */*
. I'm not sure if the bitbucket bug is still valid, can't open it.
As for the other one, it seems changing accept headers to "application/json;q=1.0, */*;q=0.9"
won't break anything.
Is there an existing issue for this?
- I have searched the existing issues
Jira Instance type
Jira Cloud (Hosted by Atlassian)
Jira instance version
No response
jira-python version
main
Python Interpreter version
3.11.1
Which operating systems have you used?
- Linux
- macOS
- Windows
Reproduction steps
import jira
# This one fails with 406
jira = jira.JIRA(
"https://some.jira.url",
basic_auth=("user", "pass"),
)
resolutions = jira.resolutions()
print(resolutions)
# This one works
jira = jira.JIRA(
"https://some.jira.url",
basic_auth=("user", "pass"),
options={
"headers": {
"Accept": "application/json;q=1.0, */*;q=0.9"
}
}
)
resolutions = jira.resolutions()
print(resolutions)
### Stack trace
```python
Traceback (most recent call last):
File "/Users/kevin/dev/gpl/sg-jira/test_jira.py", line 37, in <module>
resolutions = jira.resolutions()
^^^^^^^^^^^^^^^^^^
File "/Users/kevin/.pyenv/versions/googoo/lib/python3.11/site-packages/jira/client.py", line 2946, in resolutions
r_json = self._get_json("resolution")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/.pyenv/versions/googoo/lib/python3.11/site-packages/jira/client.py", line 3765, in _get_json
r = self._session.get(url, params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/.pyenv/versions/googoo/lib/python3.11/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/.pyenv/versions/googoo/lib/python3.11/site-packages/jira/resilientsession.py", line 223, in request
elif raise_on_error(response, **processed_kwargs):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kevin/.pyenv/versions/googoo/lib/python3.11/site-packages/jira/resilientsession.py", line 69, in raise_on_error
raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 406 url: https://sgjiratechtrial.atlassian.net/rest/api/2/resolution
Expected behaviour
200 response
Additional Context
No response