I'm encountering an issue while trying to fetch project details and issues from Jira using the Jira Python library. Despite confirming that the project with key "xxxxxx" exists in Jira through both the UI and API, I'm consistently getting a HTTP 404 error. The error message states: "No project could be found with key 'xxxxxx'."
The below is the code snippet<>
from jira import JIRA # Initialize Jira client
options = { 'server': 'https://your-instance.atlassian.net' }
jira = JIRA(options = {'server': 'https://xxxxxx.atlassian.net', 'verify': False}, basic_auth= ('xxxxxx','xxxxxxx')) # Fetch project details
project_key = 'xxxxx' project = jira.project(project_key)
print(f"Project Name: {project.name}") # Example: Fetch issues from the project
issues = jira.search_issues(f'project=={project_key}')
for issue in issues: print(f"Issue Key: {issue.key} | Summary: {issue.fields.summary}")
Error:
raise JIRAError( jira.exceptions.JIRAError: JiraError HTTP 404 url: https://xxxxx.atlassian.net/rest/api/2/project/xxxxx text: No project could be found with key 'xxxxx'. response headers = {'Date': 'Thu, 20 Jun 2024 21:13:00 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Server': 'AtlassianEdge', 'Timing-Allow-Origin': '*', 'X-Arequestid': '7b49e5f1b5479f7a74027a60cc925acd', 'X-Seraph-Loginreason': 'AUTHENTICATED_FAILED', 'X-Ratelimit-Nearlimit': 'false', 'Cache-Control': 'no-cache, no-store, no-transform', 'Content-Encoding': 'gzip', 'X-Content-Type-Options': 'nosniff', 'X-Xss-Protection': '1; mode=block', 'Atl-Traceid': '9bfe9a46d90c402da3f258e5e16287fe', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'Report-To': '{"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}', 'Nel': '{"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}', 'Transfer-Encoding': 'chunked'} response text = {"errorMessages":["No project could be found with key 'xxxxxx'."],"errors":{}}
But if I check the url response from the link it is giving the all the details and has the project with the key-"xxxxxx" so I have tried many ways but getting the same error.
I'm seeking assistance to resolve this issue promptly as I need to automate access to project data in Jira for ongoing tasks. Any guidance on what might be causing this discrepancy or additional steps to take would be greatly appreciated.