'How to fix requests.get() failure on gitlab rest api?

I am using python reqests.get() to invoke one of gitlab api's in my Python script running on Windows. It works fine on my dev machine, but it fails with below error message when I run the script in TeamCity job runner.

HTTPSConnectionPool(host='gitlab.myservice.com', port=443): Max retries exceeded with url: /api/v4/projects/1111/pipeline_schedules/111?private_token=******* (Caused by SSLError(SSLError(1, '_ssl.c:503: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure'),))

What is very strange is that very similar script that calls Artifactory rest api runs just fine in the same script even when it runs in TeamCity.

Can anybody shed light on this mystery?

Update

The infra is using Python 2.7.16. When I tested with Python 3.x it worked fine. However, the org is not ready to move to 3.x due to dependencies they cannot solve yet.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source