OpenALPR Cloud API - transfer image in body of POST request (#12112)

* Send image in body of POST request

* Fix tests

* Implement requested change
This commit is contained in:
Rene Nulsch authored and Pascal Vizeli committed 2018-02-02 14:19:13 +01:00
1 parent ad24cbddcc
commit 1d2e930900
2 files changed
+5 -4

No files matched your search

@@ -109,12 +109,14 @@ class OpenAlprCloudEntity(ImageProcessingAlprEntity):
websession = async_get_clientsession(self.hass)
params = self._params.copy()
params['image_bytes'] = str(b64encode(image), 'utf-8')
body = {
'image_bytes': str(b64encode(image), 'utf-8')
}
try:
with async_timeout.timeout(self.timeout, loop=self.hass.loop):
request = yield from websession.post(
OPENALPR_API_URL, params=params
OPENALPR_API_URL, params=params, data=body
)
data = yield from request.json()