It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
Hi all,
I am trying to connect to our internal JIRA server using some examples but have a problem. I am using the following code:
from jira import JIRA from getpass import getpass import sys import http.client def main(): http.client.HTTPConnection.debuglevel=2 http.client.HTTPResponse.debuglevel=2 jira_options = { 'server': 'https://jira.internal.server/', 'verify': 'False' } try: jira = JIRA(options=jira_options, basic_auth=('user1', 'mypassword')) # a username/password tuple except Exception as e: jira = None sys.exit(1) # Get the mutable application properties for this server (requires # jira-system-administrators permission) # props = jira.application_properties() # Find all issues reported by the admin issues = jira.search_issues('assignee=user1') # Find the top three projects containing issues reported by admin from collections import Counter top_three = Counter( [issue.fields.project.key for issue in issues]).most_common(3) if __name__ == "__main__": main()
Below is failed result:
send: b'CONNECT jira.internal.server:443 HTTP/1.0\r\n' send: b'\r\n' WARNING:root:[Errno 2] No such file or directory while doing GET https://jira.internal.server/rest/api/2/serverInfo [{'headers': {'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive', 'User-Agent': 'python-requests/2.7.0 CPython/3.5.0 Windows/7', 'X-Atlassian-Token': 'no-check', 'Accept': '*/*', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json'}, 'params': None}] WARNING:root:Got recoverable error from GET https://jira.internal.server/rest/api/2/serverInfo, will retry [1/3] in 10s. Err: [Errno 2] No such file or directory send: b'CONNECT jira.internal.server:443 HTTP/1.0\r\n' send: b'\r\n' WARNING:root:[Errno 2] No such file or directory while doing GET https://jira.internal.server/rest/api/2/serverInfo [{'headers': {'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive', 'User-Agent': 'python-requests/2.7.0 CPython/3.5.0 Windows/7', 'X-Atlassian-Token': 'no-check', 'Accept': '*/*', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json'}, 'params': None}] WARNING:root:Got recoverable error from GET https://jira.internal.server/rest/api/2/serverInfo, will retry [2/3] in 20s. Err: [Errno 2] No such file or directory send: b'CONNECT jira.internal.server:443 HTTP/1.0\r\n' send: b'\r\n' WARNING:root:[Errno 2] No such file or directory while doing GET https://jira.internal.server/rest/api/2/serverInfo [{'headers': {'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive', 'User-Agent': 'python-requests/2.7.0 CPython/3.5.0 Windows/7', 'X-Atlassian-Token': 'no-check', 'Accept': '*/*', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json'}, 'params': None}] WARNING:root:Got recoverable error from GET https://jira.internal.server/rest/api/2/serverInfo, will retry [3/3] in 30s. Err: [Errno 2] No such file or directory Process finished with exit code 1
Does anybody know what is wrong with this code ?
It seems that part of your url ia wrong. Could you check communication between your script and JIRA using fiddler2(windows) or charles(mac). It will show you every detail so it is easier to see what ia wrong.
Thanks @Deniz Oguz [The Starware] for your answer.
But when I run the following command:
curl -k https://jira.internal.server/rest/api/2/serverInfo
I get a correct answer in json format.
I haven't heard of fiddler2 at all. But after googling a bit and installing it I found the following:
After the client received notice of the established CONNECT, it failed to send any data.
I am not familiar with it - what should I look for ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have switched to Linux (more familiar for me platform) but still have the same error. This time I tried debugging:
Task 1 INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): jira.internal.server WARNING:root:[Errno 2] No such file or directory while doing GET https://jira.internal.server/rest/api/2/serverInfo [{'params': None, 'headers': {'Accept': '*/*', 'User-Agent': 'python-requests/2.8.1', 'Content-Type': 'application/json', 'Cache-Control': 'no-cache', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive', 'X-Atlassian-Token': 'no-check'}}] WARNING:root:Got recoverable error from GET https://jira.internal.server/rest/api/2/serverInfo, will retry [1/3] in 10s. Err: [Errno 2] No such file or directory INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (2): jira.internal.server WARNING:root:[Errno 2] No such file or directory while doing GET https://jira.internal.server/rest/api/2/serverInfo [{'params': None, 'headers': {'Accept': '*/*', 'User-Agent': 'python-requests/2.8.1', 'Content-Type': 'application/json', 'Cache-Control': 'no-cache', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive', 'X-Atlassian-Token': 'no-check'}}] WARNING:root:Got recoverable error from GET https://jira.internal.server/rest/api/2/serverInfo, will retry [2/3] in 20s. Err: [Errno 2] No such file or directory INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (3): jira.internal.server WARNING:root:[Errno 2] No such file or directory while doing GET https://jira.internal.server/rest/api/2/serverInfo [{'params': None, 'headers': {'Accept': '*/*', 'User-Agent': 'python-requests/2.8.1', 'Content-Type': 'application/json', 'Cache-Control': 'no-cache', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive', 'X-Atlassian-Token': 'no-check'}}] WARNING:root:Got recoverable error from GET https://jira.internal.server/rest/api/2/serverInfo, will retry [3/3] in 30s. Err: [Errno 2] No such file or directory INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (4): jira.internal.server WARNING:root:[Errno 2] No such file or directory while doing GET https://jira.internal.server/rest/api/2/serverInfo [{'params': None, 'headers': {'Accept': '*/*', 'User-Agent': 'python-requests/2.8.1', 'Content-Type': 'application/json', 'Cache-Control': 'no-cache', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive', 'X-Atlassian-Token': 'no-check'}}] WARNING:root:Got recoverable error from GET https://jira.internal.server/rest/api/2/serverInfo, will retry [4/3] in 40s. Err: [Errno 2] No such file or directory
Can anyone shed some light how can I debug it even further ?
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.
It is working now. I made a few changes so not sure which one is the right one but one of the changes was in jira_options - previously I used the following code: jira_options = { 'server': 'https://jira.local.server/';, 'verify': 'False' } Now I am using: jira_options = { 'server': 'https://jira.local.server/';, 'verify': False } (no quotes around False). It sounds strange (I couldn't believe it is just that simple).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Przemyslaw Bak,
I met the same problem with you, but my JIRA server is not using https connection.
This problem happen randomly and I have no idea when it happen.
I also tried with python 3.6, but same with python 2.7.
One more thing, I never met this problem when I use python on Windows PC.
If you found anything can solve this problem, please share.
Thank you so much,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Finally I found the root-cause.
The problem is Domain resolution response time.
On Windows server, I put the correct DNS information (Primay and Secondary DNS), that's why when jira-client cannot receive DNS response from Primary DNS, it will query through Secondary DNS and get the response before timedout.
On Linux PC, I used only one primary DNS, and Secondary DNS is google DNS (8.8.8.8). that's why this issue just happened randomly (when primary DNS got highload)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This approach requires you to have the JIRA administrative rights. The main aim of this article is to help you achieve an organized, easy-to-maintain workflows in your JIRA instance thereby, reducin...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.