pycontribs / jira

Python Jira library. Development chat available on https://matrix.to/#/#pycontribs:matrix.org
https://jira.readthedocs.io
BSD 2-Clause "Simplified" License
1.95k stars 864 forks source link

Client incorrectly sends *.* for Accept header, instead of */* #1774

Closed bkelley17 closed 9 months ago

bkelley17 commented 9 months ago

Bug summary

The client can send the HTTP Accept header as application/json,*.*;q=0.9 which is invalid. This should be application/json,*/*;q=0.9. Note */* in place of the incorrect *.*. A quick search shows that this comes from resilientsession.py line 165. Amazingly this does not currently fail when calling Jira Cloud, but the incorrect Accept header is (increasingly) likely to return a 406 error.

Is there an existing issue for this?

Jira Instance type

Jira Cloud (Hosted by Atlassian)

Jira instance version

latest

jira-python version

any

Python Interpreter version

any

Which operating systems have you used?

Reproduction steps

from jira import JIRA

jira = JIRA('https://jira.atlassian.com/')

jira.server_info()

Stack trace

None yet.

Expected behaviour

Expect not to get 406 error.

Additional Context

No response

jabadia commented 9 months ago

this caused JIRA cloud to return 406 error from /resolutions endpoint last week

ili-shmidt-wib commented 9 months ago

Any update? Also 406 error from jira.projectcategories()

rachelpeterson89 commented 9 months ago

We're experiencing a 406 error from jira.groups() and jira.group_members() as well

dbaxa commented 9 months ago

We're experiencing a 406 error from jira.groups() and jira.group_members() as well

You should be able to workaround the issue by creating JIRA client instances like so ->

JIRA(url_to_jira_instance, basic_auth=("example", "apikeyhere"), 
     options={"headers": {"Accept": "application/json,*/*;q=0.9"}}) 
solarissmoke commented 9 months ago

This appears to now be affecting pretty much all Jira endpoints. I cannot even instantiate the client any more without getting a 406 error from the serverInfo endpoint.

thenamanpatwari commented 9 months ago

Affecting all JIRA endpoints and returning 406 errors. workaround provided by @dbaxa mitigated the issue.

Using jira pypi version 3.5.0

PavelVanecekAtlassian commented 9 months ago

Hi everyone, just FYI we have reverted the serverInfo endpoint to accept the previous header again. Turns out that there's something out there calling the endpoint a lot!

sfc-gh-pannadate commented 9 months ago

We had the same issue, we added Headers, which resolved it.

headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
jira = JIRA(server=jira_url, basic_auth=(jira_username, jira_password), options={'server': jira_url, 'headers': headers})