I need help with below error,
Jira hosted on SSO Okta and when I try to fetch JIra data using bearer token i see error below, Please i need urgent help with this
An error occurred during the request: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None
import requests
import json
# Replace with your Jira instance URL and the API endpoint
API_ENDPOINT = "/rest/api/2/search" # Example: fetching issues
# Replace with your generated Personal Access Token (PAT) or OAuth token
BEARER_TOKEN = "APITOKEN_HERE"
# Construct the full URL
url = f"{JIRA_BASE_URL}{API_ENDPOINT}"
# Set up the headers with the bearer token for authentication
headers = {
"Authorization": f"Bearer {BEARER_TOKEN}",
"Accept": "application/json"
}
try:
response = requests.get(url, headers=headers, params=params)
response.raise_for_status() # Raises an HTTPError for bad responses (4xx or 5xx)
jira_data = response.json()
if 'issues' in jira_data:
print("Fetched Jira Issues:")
for issue in jira_data['issues']:
print(f" - Key: {issue['key']}, Summary: {issue['fields']['summary']}")
else:
print("No issues found or unexpected response format.")
except requests.exceptions.RequestException as e:
print(f"An error occurred during the request: {e}")
except json.JSONDecodeError:
print("Failed to decode JSON response.")