Using Python to interact with JIRA

I’m new to Python and trying to create a tool that connects to JIRA. The goal is to fetch resolved issues and generate an HTML report of bug fixes for each release. I’ve installed the jira-python library but I’m having trouble connecting to JIRA.

Here’s the code I’m using:

from jira.client import JIRA

jira_options = {'server': 'https://mycompany.atlassian.net'}
jira = JIRA(options=jira_options, basic_auth=('myusername', 'mypassword'))

When I run this, I get an error:

TypeError: session() takes no arguments (2 given)

What am I doing wrong? Also, I can’t find info about automation in the JIRA docs. Any help or guidance would be appreciated.

Update: I think I need to enable basic HTTP authentication for my JIRA instance. I’ll try that next.

I’ve been in your shoes, working with JIRA and Python. The connection issue you’re facing is likely due to a mismatch between your JIRA server version and the jira-python library version. I’d suggest checking your JIRA server version and ensuring you’re using a compatible jira-python version.

For authentication, consider using an API token instead of your password. It’s more secure and less prone to issues. You can generate one in your JIRA account settings.

Regarding automation, JIRA’s REST API is quite comprehensive. You can use it to fetch resolved issues, create custom JQL queries, and even update ticket fields programmatically. For generating HTML reports, you might want to look into using a templating engine like Jinja2 alongside the JIRA data you fetch.

Remember to handle rate limiting and error cases in your code to ensure robustness. Good luck with your project!

Having worked extensively with JIRA and Python, I can share some insights. The error you’re encountering is likely due to an outdated version of the jira-python library. I’d recommend upgrading to the latest version using pip install --upgrade jira.

For connecting to JIRA, I’ve found using an API token instead of a password to be more secure and reliable. You can generate one in your JIRA account settings. Here’s an example of how I typically set up the connection:

from jira import JIRA

jira = JIRA(server='https://mycompany.atlassian.net',
            basic_auth=('[email protected]', 'your_api_token'))

As for automation, JIRA’s REST API is quite powerful. You can use it to fetch resolved issues, create custom JQL queries, and even update ticket fields. For generating HTML reports, I’ve had success combining JIRA data with a templating engine like Jinja2.

Remember to handle authentication securely and consider rate limiting to avoid overwhelming the JIRA server. Good luck with your project!

hey there! i’ve done some jira stuff with python before. make sure ur using the latest jira-python version. try this:

from jira import JIRA

jira = JIRA(‘https://mycompany.atlassian.net’, basic_auth=(‘email’, ‘api_token’))

get an API token from ur jira settings. it’s way better than using ur password. good luck with ur project!