Tls failed to verify when sending API request

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?
PyPI
tls-client
Advanced Python HTTP Client.
Solution:
i suggest you not run user bots on railway as that breaks the fair use agreement
Jump to solution
11 Replies
Percy
Percy5mo ago
Project ID: 4cc29972-e583-4641-81d0-26868fcc02e7
Brody
Brody5mo ago
please provide more context
jorgemayto
jorgemaytoOP5mo ago
4cc29972-e583-4641-81d0-26868fcc02e7
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)
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
verify=False
but then that's not secure
Brody
Brody5mo ago
what service are you calling where you are trying to spoof a users browser?
jorgemayto
jorgemaytoOP5mo 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
Brody
Brody5mo ago
do they provide an official api? it looks like you are trying to spoof a user
jorgemayto
jorgemaytoOP5mo ago
theres no official one
Brody
Brody5mo ago
then im sorry but we would not be able to help here
jorgemayto
jorgemaytoOP5mo ago
ah ok nws
Solution
Brody
Brody5mo ago
i suggest you not run user bots on railway as that breaks the fair use agreement
jorgemayto
jorgemaytoOP5mo ago
okk
Want results from more Discord servers?
Add your server