简体   繁体   中英

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.

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}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM