How to connect to On-premise Jira server and export the CSV file for issues using Python script

siddusamshi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 28, 2023

I am new to Python in connecting the Jira server which is hosted on-premise, I want to connect and export the CSV file for our project issues. I have written the below code and executed on command line but it is not working. Can anyone please help me in resolving this?

from jira import JIRA
import requests

jira = JIRA(basic_auth=('user@mail.com', 'password123'), options={'server': 'https://jiraaccount.domain.com'})
issue = jira.issue('ID-544')
print(issue.fields.project.key)
print(issue.fields.issuetype.name)

----------------This code throws the below error---------------- 

<!-- HTTPError403 -->
<div class="aui-page-panel" ><div class="aui-page-panel-inner">
<main role="main" id="main" class="aui-page-panel-content" >
<div class="aui-page-header" ><div class="aui-page-header-inner">
<div class="aui-page-header-main" >
<h1>Forbidden (403)</h1>
</div>
</div></div>
<div class="aui-message aui-message-warning warning">
<p>Encountered a <code>&quot;403 - Forbidden&quot;</code> error while loading this page.</p>
<p>Basic Authentication Failure - Reason : AUTHENTICATION_DENIED</p>

1 answer

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 29, 2023

Hello @siddusamshi 

Welcome to the Atlassian community.

The error suggest that the credentials you provided are not valid for logging in to the specified Jira server.

If you open the Jira server URL in a browser and enter those same credentials, is the login successful?

siddusamshi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 3, 2023

Hello Trudy Claspill,

Thank you for the response!

We're using SAML SSO Microsoft Logging into the Jira Application, and I'm able to login into the Jira Application using our Microsoft Credentials, and we are using Personal Access Token in the code to access Jira app.

Only I am not able to access using the code, even using PTA in the code.

Thank you again!

Suggest an answer

Log in or Sign up to answer