Created
March 23, 2020 09:54
-
-
Save maxoobot/51828d8d98fd36fe1d7df9d048995d3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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