Answer the question
In order to leave comments, you need to log in
Requests: HTTP for humans can't send POST?
Hello. There was a need through Python to send a request to the API server with the current XOR encryption technology. The original function is in PHP, and it looks like this:
$myCurl = curl_init();
curl_setopt_array($myCurl, array(
CURLOPT_URL => 'http://example.ru/method/Test',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $hashed,
));
$response = curl_exec($myCurl);
curl_close($myCurl);
request = requests.post("http://example.ru/method/Test", data=hashed)
print(request.text)
Answer the question
In order to leave comments, you need to log in
request = requests.post("http://example.ru/method/Test", data=dict(s.split("=") for s in hashed.split("&")))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question