Skip to content

Instantly share code, notes, and snippets.

@maxoobot
Created March 23, 2020 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxoobot/51828d8d98fd36fe1d7df9d048995d3b to your computer and use it in GitHub Desktop.
Save maxoobot/51828d8d98fd36fe1d7df9d048995d3b to your computer and use it in GitHub Desktop.
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