'Robot Framework Requests could not find cert path

I am running the following keyword below to create a client cert session and it creates it perfectly fine:

Create Client Cert Session  alias=${alias}  url=${url}  client_certs=(${cert_path},${key_path})  verify=${False}

${cert_path} = /path/to/cert.pem

${key_path} = /path/to/key.pem

However, when I try to do a get request using the following keyword it gives me the following error:

Get Request alias=${alias} uri=${Enrollment_URI}

Error:

OSError: Could not find the TLS certificate file, invalid path: (

I printed out the path for the cert from the session object within the python requests library and it prints out like this:

('(', '/', 'p', 'a', 't', 'h', '/', 't', 'o', '/', 'c', 'e', 'r', 't', '.', 'p', 'e', 'm',')')

This is printed from the function that is sending the get request, not the session creation.

From the error, it looks like the function in the get request is only reading the first ( in the path above and not recognizing it. I am not sure if there is something I should be doing to the path before I pass it into the keyword.



Solution 1:[1]

Robot is not python. client_certs=(${cert_path},${key_path}) doesn't pass a tuple as the client_certs value. It is passing a string that literally beings with a ( as the first character. That is why you get an error with invalid path '('.

If you need to pass a list to Create client cert session, you have to create the list in a separate step:

@{client certs}=  create list  ${cert_path}  ${key_path}
Create Client Cert Session  alias=${alias}  url=${url}  client_certs=${client certs}  verify=${False}

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Bryan Oakley