Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import cv2 as cv
import requests
import os
# Request info
url = "<EAS service URL>"
token = "<EAS service token>"
headers = { 'Authorization' : token }
# Image data
directory = os.path.dirname(os.path.realpath(__file__))
img_name = "tshirt.jpg"
img = cv.imread(directory + "/" + img_name, 1)
_, img_encoded = cv.imencode('.jpg', img)
body = img_encoded.tostring()
# Request
response = requests.post(url, data=body, headers=headers)
print("status", response, "response:", response.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.