问题
I am trying to call rally server simply using below:
rally = Rally(server, user, password, workspace=workspace, project=project)
But it is giving below error:
Traceback (most recent call last):
File "testprint.py", line 20, in <module>
rally = Rally(server, user=user, password=password, workspace=workspace, project=project)
File "C:\RallyRestToolkitForPython-master\pyral\restapi.py", line 259, in __init__
self.contextHelper.check(self.server, wksp, proj, self.isolated_workspace)
File "C:\RallyRestToolkitForPython-master\pyral\context.py", line 171, in check
user_response = self._getUserInfo()
File "C:\RallyRestToolkitForPython-master\pyral\context.py", line 276, in _getUserInfo
raise RallyRESTAPIError(problem)
pyral.context.RallyRESTAPIError: Target Rally host: 'rally1.rallydev.com ' non-existent or unreachable
Since i am behind proxies, i put HTTP and HTTPS proxies in python code:
os.environ['HTTPS_PROXY'] = "PROXY:PORT"
os.environ['https_proxy'] = "PROXY:PORT"
os.environ['HTTP_PROXY'] = "PROXY:PORT"
It is now failing with below error:
Traceback (most recent call last):
File "testprint.py", line 20, in <module>
rally = Rally(server, user=user, password=password, workspace=workspace, project=project)
File "C:\RallyRestToolkitForPython-master\pyral\restapi.py", line 259, in __init__
self.contextHelper.check(self.server, wksp, proj, self.isolated_workspace)
File "C:\RallyRestToolkitForPython-master\pyral\context.py", line 171, in check
user_response = self._getUserInfo()
File "C:\RallyRestToolkitForPython-master\pyral\context.py", line 276, in _getUserInfo
raise RallyRESTAPIError(problem)
pyral.context.RallyRESTAPIError: 'Cannot connect to proxy.', error('Tunnel connection failed: 504 Unknown Host
My proxies are working, as i have run other code to verify.
回答1:
I just had to work through this issue and it was caused by my Python installation not using TLS 1.2. You will need to ensure the version of OpenSSL that is being used by your Python support TLS 1.2.
To see the TLS version in use you can do this check:
python -c "import requests; print(requests.get('https://www.howsmyssl.com/a/check', verify=False).json()['tls_version'])"
To see which OpenSSL is in use:
python -c "import ssl; print(ssl.OPENSSL_VERSION)"
I don't have the resolution to get OpenSSL updated to the right version. I am sure you will be able to find something for your own environment.
回答2:
In addition to Michale's answer, you can also check this (i had same errors and below steps resolved mine). I did not use the comamnds "os.environ['HTTPS_PROXY']...". The issue was resolved after below steps -
- go to pyral location
- edit config.py file to include your rally log in credentials for fields USER_NAME and PASSWORD
- open command prompt in admin mode and run command set HTTPS_PROXY==http://user:password@proxy.domain.com:port
- for user id/psw, use your SSO credentials and not Rally credentials (if they are different).
- Then run the file sample.py and it worked
回答3:
This issue has been resolved after updating the "requests" package to version "2.12.5" Thank you all for the help.
来源:https://stackoverflow.com/questions/51926096/rally-host-is-non-existent-or-unreachable-via-pyral