The curl command works as expected. But similar python code does not.
# curl -X POST -H "Content-Type: application/json" -d '{"img_url":"http://tleyden-misc.s3.amazonaws.com/blog_images/ocr_test.pnge","engine":"tesseract"}' http://35.154.148.131:9292/ocr
Expected output:
You can create local variables for the pipelines within the template by
prefixing the variable name with a "$" sign. Variable names have to be
composed of alphanumeric characters and the underscore. In the example
below I have used a few variations that work for variable names.
I tried this python code:
import requests
url = 'http://35.154.148.131:9292'
data = {"img_url":"http://tleyden-misc.s3.amazonaws.com/blog_images/ocr_test.png","engine":"tesseract"}
r = requests.post( url, json={'json_payload': data})
This returns the following error:
b'<h1>OpenOCR is running!<h1> Need <a href="http://www.openocr.net">docs</a>?'
How do I post the dictionary using data parameter?
r = requests.post( url, json=data)? According to documentation that's the way to use it. Also, in your Python code, you are missing the/ocrendpoint in the URL.