I work with one project about text ocr
my code on python:
import requests
url = "https://translate.yandex.net/ocr/v1.1/recognize?srv=tr-image&sid=&lang=ru&rotate=auto&yu=&yum=&sprvk="
headers = {
"Connection": "keep-alive",
"sec-ch-ua": '"Chromium";v="118", "Google Chrome";v="118", "Not=A?Brand";v="99"',
"sec-ch-ua-platform": "Windows",
"sec-ch-ua-mobile": "?0",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
"Accept": "*/*",
"Origin": "https://translate.yandex.ru",
"Sec-Fetch-Site": "cross-site",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "https://translate.yandex.ru/ocr",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7",
}
files = {
'fieldNameHere': ('da.webp', open('da.webp', 'rb'), 'image/webp')
}
response = requests.post(url, headers=headers, files=files,verify=False)
print(response.text)
What is wrong - when i just run app without any mitm proxy or sniff apps i get nothing in answer enter image description here
But, when i run fiddler (app to sniff http/https requests) and run code, i get good answer with all data what i need enter image description here
What it can be?
i try use different headers, but it also without results
You can try to suppress the security warning on the
urllib3level. Also, don't send anyheaders=:Prints:
Image used: