1

I'm using Python 3.9 and this Jira python API https://jira.readthedocs.io/en/latest/index.html and I'm having this error when searching for issue: The character '%' is a reserved JQL character.

The problem is that the implementation of this api encode the jql query, and query like that:

jira_obj = JIRA(server=jira_url, basic_auth=(user, pwd))
query="status not in (Closed) AND assignee in (PIPPO, PLUTO)"
jira_obj.search_issues(jira_query)

will be encoded as https://jiradomain.com/jira/rest/api/2/search?jql=status+not+in+%2528Closed%2529+AND+assignee+in+%2528PIPPO%252CPLUTO%2529

where % is a reserved character of JQL.

Andrea Bellizzi
  • 497
  • 5
  • 14

1 Answers1

1

You are facing this problem because of double encoding. There are lot of threads on the matter: What is url encoding %2526?

Springboot : Prevent double encoding of % by Resttemplate

Specifically for JIRA, you can see here: https://github.com/pycontribs/jira/issues/336

The solution given in the github issue maybe relevant to you:

Edit: I could resolve the issue - I used an obsolete server endpoint that just redirected everything to a new endpoint which caused this problem. So I can confirm that in my case it was not a problem with python jira.

The double encoding will happen if forwarding is happening. Please check whether that is the case.

  • But I'll get the error also with a single encoding, because also the first time I'll get the % character – Andrea Bellizzi Jul 06 '21 at 09:17
  • @AndreaBellizzi one time encoding is expected and needed so you should be okay. The question is why you are getting double encoding. What I have given above is _one_ way. If you have access to JIRA logs you will know more. You can also try with `curl`: `https://developer.atlassian.com/server/jira/platform/jira-rest-api-example-query-issues-6291606/`. If you get no errors you will know that problem is with python jira. –  Jul 06 '21 at 14:41