Robot test case fails in jenkins with proxy https connection error

Hi,Robot test case fails in jenkins with proxy https connection error.

I have tested curl -k which works in jenkins shell.

Kindly help

Hi Sayed,

Unfortunately you didn’t give us much information so we can only guess. I’ll ask some questions for the information your missing but which might also lead you to the answer:

  • does the curl command have any proxy server settings passed to it?
  • does the robot test cases specify a proxy server somewhere? (maybe inside a keyword?)
    • is it the same proxy settings as the curl command?
  • do you need a proxy setting in the office but not for the Jenkins runner and someone forgot to remove the proxy settings when they checked in their robot test?
  • which library is the robot test using? (we need to know this to help you with configuring the proxy settings in robot)

Hopefully this helps,

Dave.

Hi Dave,
Thanks for the promot response.

  1. I am using curl with -k and no proxy is used and able to hit the API
  2. I am trying to run robot test case in jenkins not sure of proxy settings
  3. Robot test case doesnt use proxy settings
  4. I am trying to access Rest API using Request Library

Kindly help with your guidance to fix the issue

Hi Sayed,

Can you share the exact line from you robot that get the error and also the error details from the robot log (log.html) there might be some clues to the problem there?

I’m guessing it’s not a proxy error, the error probably just mentions that setting the proxy might be a solution.

Also if you can share the exact curl command that works for comparison, that might help us identify the problem.

Dave.

Hi Dave,
Appreciate your support and response . Please find below details

ProxyError: HTTPSConnectionPool(host=‘hotname’, port=1234): Max retries exceeded with url: /api/GetInfo (Caused by ProxyError(‘Unable to connect to proxy’, NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x00000233C8F86C10>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond’)))

curl -k --location ‘https://hostname:port/api/GetInfo’
–header ‘ChannelMedia: web’
–header ‘ReferenceId: hjgdjfgdfgfd’
–header ‘SourceSystemID: ABCD’
–header ‘OperationName: GetInfo’
–header ‘Sent: 2025-02-07T19:53:02.098’
–header ‘Content-Type: application/json’
–header ‘Authorization: Basic T01SSDJDGDSGJDGDGDSGDSGDGD’
–data ‘{
“pNo”: “66818013338”,
“Start”: “2024-01-01T00:00:00”,
“End”: “2024-01-01T23:59:59”
}’

I did a bit of searching to try and help you find the answer;

Ok this error is just a generic error saying that python was not able to make a connection to your api server (https://hostname:port), the error comes from the python urllib3 module that the python requests module uses, Requests Library uses python requests module to make the web calls.

So that got me wondering if curl could use a proxy server for it’s connection if you didn’t specify one on the command line? And indeed it can using the http_proxy and https_proxy environment variables.

That sent me down the rabbit hole of checking if python requests also supports these variables? And it does, I also found if you aren’t using a proxy then the failed connection message above would be different ( something like Errno 10061] or [Errno 11004])

So from what you’ve given us I suspect what’s happening:

  • curl is using the proxy connection from the http_proxy or https_proxy environment variables, so this is why curl works
  • Requests Library is attempting to connect to a proxy but failing
    • is it the same proxy as curl is using?
    • does the proxy need authentication?

So your next steps would be:

  • check if the http_proxy and https_proxy environment variables are set in your environment (I expect they are) and what their values are
  • check does the proxy server requires authentication?

I notice that in your curl command you are passing:

Are you also passing this header in your Requests Library keyword? perhaps this is the authentication details that the proxy server needs?

I’ll also note it’s not uncommon for a web server to refuse a request if there is a missing/incorrect header (especially for api calls) so double check all the headers in robot code.

Hope this helps you find the solution,

Dave.