Tls failed to verify when sending API request

andremaytorenaPRO

a year 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 = tlsclient.Session( clientidentifier="chrome120", randomtlsextensionorder=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?

0 Replies

a year ago

please provide more context


andremaytorenaPRO

a year ago

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


andremaytorenaPRO

a year ago

py 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


a year ago

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


andremaytorenaPRO

a year 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


a year ago

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


andremaytorenaPRO

a year ago

theres no official one


a year ago

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


andremaytorenaPRO

a year ago

ah ok nws


a year ago

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


andremaytorenaPRO

a year ago

okk