Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

API: where to add header in python-JIRA authentication

Himanshu Pupneja May 7, 2018

 

Where should I add a header in python-jira authentication?

My header should be like the below. load balancer is redirecting request based on dns name only. That's why it is required for me.

Header:

'host': 'DNS_of_server'

 

I have the below code, where should I add the header in this? I couldn't able to find that in the documentation.

 options = {
'server': 'https://ip-address',
}
try:
jira = JIRA(options, basic_auth=(user, passwd))
except JIRAError as e:
print(e.status_code, e.text)

 

It works fine in curl command when I pass header parameter with curl.

1 answer

1 accepted

0 votes
Answer accepted
Matt Doar
Community Champion
May 7, 2018

I've added it to the JIRA object in __init__.py but you should be able to update your JIRA object in your code. Look for a headers list in that object 

Himanshu Pupneja May 7, 2018

Thanks for your response Matt

 

Are you referring to this one?

 

 __init__(self, server=None, options=None, basic_auth=None, oauth=None, jwt=None, kerberos=False, kerberos_options=None, validate=False, get_server_info=True, async=False, logging=True, max_retries=3, proxies=None, timeout=None, auth=None) 

Matt Doar
Community Champion
May 7, 2018

Yes. Take a look at dir(jira) and the headers member in there

Himanshu Pupneja May 7, 2018

Got it, And it's working well.

Thanks for your help Matt.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events