I have a build step on TeamCity that uses a custom python script. When I try to run the build I get the following error:
[20:57:12][Step 1/3] Traceback (most recent call last):
[20:57:12][Step 1/3] File "/amirsys/teamcity-agent/lastBuildStatus.py", line 24, in <module>
[20:57:12][Step 1/3] main()
[20:57:12][Step 1/3] File "/amirsys/teamcity-agent/lastBuildStatus.py", line 13, in main
[20:57:12][Step 1/3] build = getLastBuild(buildId)
[20:57:12][Step 1/3] File "/amirsys/teamcity-agent/teamcity.py", line 204, in getLastBuild
[20:57:12][Step 1/3] return requests.get(url, auth=auth)
[20:57:12][Step 1/3] File "/usr/lib/python2.7/dist-packages/requests/api.py", line 55, in get
[20:57:12][Step 1/3] return request('get', url, **kwargs)
[20:57:12][Step 1/3] File "/usr/lib/python2.7/dist-packages/requests/api.py", line 44, in request
[20:57:12][Step 1/3] return session.request(method=method, url=url, **kwargs)
[20:57:12][Step 1/3] File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 335, in request
[20:57:12][Step 1/3] resp = self.send(prep, **send_kwargs)
[20:57:12][Step 1/3] File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 438, in send
[20:57:12][Step 1/3] r = adapter.send(request, **kwargs)
[20:57:12][Step 1/3] File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 327, in send
[20:57:12][Step 1/3] raise ConnectionError(e)
[20:57:12][Step 1/3] requests.exceptions.ConnectionError: HTTPSConnectionPool(host='teamcity.amirsys-int.com', port=443): Max retries exceeded with url: /httpAuth/app/rest/builds/buildType:bt262,count:1 (Caused by <class 'socket.error'>: [Errno 110] Connection timed out)
I have researched and found an answer that I think it could be here: Max retries exceeded with URL. They suggest using:
from time import sleep
to spread out the request interval? Is this what I need to do?
I don't understand how I can be sending too many requests as my script only makes this simple request:
def getLastBuild(buildConfigId):
url = path + 'builds/buildType:' + buildConfigId + ',count:1'
return requests.get(url, auth=auth)
def main():
buildId = sys.argv[1]
build = getLastBuild(buildId)
if build.status_code == 200:
result = "SUCCESS"
print result
else:
result = "FAILURE"
print result
if __name__ == "__main__":
main()
Why is this request refused?