1

I am new to Jira-Python module. I am using below snippet to connect to my jira server.

try:
    print "Connecting to JIRA: %s" % jira_server
    jira_options = {'server': jira_server, 'verify':False}
    jira = JIRA(options=jira_options,
                basic_auth=(jira_user, 
                            jira_password))
    return jira
except Exception,e:
    # jira_options = {'server': jira_server, 'verify':False}
    # time.sleep(60)
    jira = JIRA(options=jira_options,
                basic_auth=(jira_user, 
                            jira_password))
    print "Failed to connect to JIRA: %s" % e
    sys.exit()

Sometimes above codes works fine. But most of the times it fails with below error:

 HTTPSConnectionPool(host='my_jira_server_name', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02D48450>: Failed to establish a new connection: [Errno 10061] No connection could be made because the target machine actively refused it',))

Can any one help me. Thanks in advance!

Daniel Fortunov
  • 43,309
  • 26
  • 81
  • 106
  • Are you sure it is not related to your network? – Padraic Cunningham Feb 05 '16 at 09:40
  • Thanks. But is there anyway to check whether it is related to network issues? – Michael Jacob Feb 05 '16 at 09:47
  • put the code in a try / catch block and have another go (after a delay) if max retries is seen. Also I notice the error is coming from urllib3, which has configurable retries see https://urllib3.readthedocs.org/en/latest/#retry – Vorsprung Feb 05 '16 at 10:27
  • thanks. But not working. I have tried like this. try: jira_options = {'server': jira_server, 'verify':False} jira = JIRA(options=jira_options, basic_auth=(jira_user, jira_password)) return jira except Exception,e: time.sleep(60) jira = JIRA(options=jira_options, basic_auth=(jira_user, jira_password)) print "Failed to connect to JIRA: %s" % e sys.exit() – Michael Jacob Feb 05 '16 at 13:23
  • I have tried to change the retry count also. But not connecting to server. ..\urllib3\poolmanager.py retries = 10#kw.get('retries') if not isinstance(retries, Retry): retries = Retry.from_int(retries, redirect=redirect) – Michael Jacob Feb 05 '16 at 13:28

0 Answers0