Online OCR works, but Free OCR API doesn't in my code. how can we choose OCR version engine in python?

I execute my program and it not work. but when i use the online ocr, it’s work. I only choose the Engine3 on the online version so… idk. '(and i don’t want to just web-scraping so.. please help )

If you test the connection with Postman, do you get the same result?

You probably know it, but just in case: Postman is a free API test app.

If you see the problem even with Postman, a screenshot of the result could be helpful.

hi, i’m a beginner here, i know nothing and i don’t know how to use postman T-T. I will try my best but i don’t understant. Does my api call with python will be usefull ? Thanks for your answer btw.

Does this code work for you?

import requests

url = "https://api.ocr.space/parse/image"

payload = {'ocrengine': '3'}
files=[
  ('file',('4mb.pdf',open('/C:/test/ocrtest/4mb.pdf','rb'),'application/pdf'))
]
headers = {
  'apikey': 'YOUR-API-KEY'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)