Tls failed to verify when sending API request
andremaytorena
PROOP

2 years ago

I have a python server hosted on railway, when it tries to call an external api like this:

https://pypi.org/project/tls-client/

session = tls_client.Session(

client_identifier="chrome_120",

random_tls_extension_order=True,

)

response = session.post(url, headers=headers, json=payload)

It shows this error:

ERROR:root:failed to do request: Post "URL";: tls: failed to verify certificate: x509: certificate signed by unknown authority

but it works locally, could it be a wrong setup of my certification in my server? or any ideas?

11 Replies

2 years ago

please provide more context


andremaytorena
PROOP

2 years ago

4cc29972-e583-4641-81d0-26868fcc02e7


andremaytorena
PROOP

2 years ago

url = ""
    payload = {
        "leisureManagementToken": token,
        "password": password,
        "passwordConfirm": password
    }
    headers = {
        'Accept':'application/json',
        'Accept-Encoding':'gzip, deflate, br, zstd',
        'Accept-Language':'en-US,en;q=0.9',
        'Content-Type':'application/json',
        'Origin':'ORIGIN',
        'Priority':'u=1, i',
        'Referer':'ORIGIN',
        'Sec-Ch-Ua':'"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
        'Sec-Ch-Ua-Mobile':'?0',
        'Sec-Ch-Ua-Platform':'"macOS"',
        'Sec-Fetch-Dest':'empty',
        'Sec-Fetch-Mode':'cors',
        'Sec-Fetch-Site':'same-site',
        'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'
    }
    response = session.post(url, headers=headers, json=payload)```

so this request is sent in my server, when the request is sent it automatically returns the error I showed above, from what I researched it's due to the certification file not being found properly or something like that, I could add this onto the request for it to work: ```verify=False``` but then that's not secure


2 years ago

what service are you calling where you are trying to spoof a users browser?


andremaytorena
PROOP

2 years ago

it's for a gym, im trying to link my server to their service so I can create a custom ui and some other features


2 years ago

do they provide an official api? it looks like you are trying to spoof a user


andremaytorena
PROOP

2 years ago

theres no official one


2 years ago

then im sorry but we would not be able to help here


andremaytorena
PROOP

2 years ago

ah ok nws


2 years ago

i suggest you not run user bots on railway as that breaks the fair use agreement


andremaytorena
PROOP

2 years ago

okk


Welcome!

Sign in to your Railway account to join the conversation.

Loading...