Hi!
I'm trying to connect to Jira with python, using Atlassian Python API’s. I've generated Personal Access Token and is using code from your example here
I'm trying to run this script in my jupyter notebook:
{noformat}
from atlassian import Jira
jira = Jira(
url='https://my.jira.domain/',
token='my PAT'
)
jira.projects(included_archived=None)
{noformat}
And I get this error:
TypeError: __init__() got an unexpected keyword argument 'token'
Can you please help me to solve it? Maybe you can provide me with more examples how to use this PAT for connecting to Jira?
Thanks in advance
Instead of "token", you may use "token_auth"
from jira import JIRA
jira_connection = JIRA(
options={'server': 'https://xxxx.com'},
token_auth='yourPatTokenasdfqwerty'
)
Hmm, one thing I noticed: your code suggests you're using Jira Cloud, while the code examples in the page you linked are for Jira Server or Data Center.
Are you sure that you're using the correct code for the correct deployment type?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you are right, there are different code examples for cloud and for Jira Sever, according to the link.
And, if i got it right, the code I attached is for server, while for the cloud it should be like this, with API token.
jira = Jira( url='https://your-domain.atlassian.net', username=jira_username, password=jira_api_token, cloud=True)
I've attached screen with this part of documentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.