so bin nen schritt weiter, habe die Exception umgebaut, so dass er vernünftig loggt - eines meiner Geräte heißt "Büro", das mag er wohl beim laden nicht?
Bitte passt das ('Error while getting Devices: %s' %err) so bei Dir an.. im code war ", err"
für das ut8 brauchst du ne python weiche wie im pushbullet plugin:
Müsste dann so sein:
update das gleich nochmal, muss glaube ich noch in str casten
Bitte passt das ('Error while getting Devices: %s' %err) so bei Dir an.. im code war ", err"
Code:
try:
buffer = BytesIO()
myCurl = pycurl.Curl()
myCurl.setopt(myCurl.URL,'https://alexa.amazon.de/api/devices-v2/device?cached=false')
myCurl.setopt(pycurl.FOLLOWLOCATION, 1)
myCurl.setopt(pycurl.COOKIEJAR ,self.cookiefile)
myCurl.setopt(pycurl.COOKIEFILE ,self.cookiefile)
myCurl.setopt(pycurl.WRITEDATA , buffer)
myCurl.setopt(pycurl.HTTPGET,1)
myCurl.perform()
self.logger.error('Status of getDevicesbyCurl: %d' % myCurl.getinfo(myCurl.RESPONSE_CODE))
body=buffer.getvalue()
mybody = body.decode()
myDict=json.loads(mybody)
myDevices = EchoDevices()
self.logger.error("DONE")
except Exception as err:
self.logger.error('Error while getting Devices: %s' %err)
return None
Code:
2019-05-04 11:16:30 ERROR plugins.alexarc4shng Status of getDevicesbyCurl: 200 2019-05-04 11:16:30 ERROR plugins.alexarc4shng Status of getDevicesbyCurl: 200 2019-05-04 11:16:30 ERROR plugins.alexarc4shng Error while getting Devices: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte 2019-05-04 11:16:30 ERROR plugins.alexarc4shng Error while getting Devices: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
Code:
if sys.version_info < (3, 5):
upload_request_response = requests.post(self._upload_apiurl, data=json.dumps(
{"file_name": os.path.basename(filepath),
"file_type": magic.from_file(filepath, mime=True).decode("UTF-8")}), headers=headers,
auth=(apikey, ""))
else:
upload_request_response = requests.post(self._upload_apiurl, data=json.dumps(
{"file_name": os.path.basename(filepath), "file_type": magic.from_file(filepath, mime=True)}),
headers=headers, auth=(apikey, ""))
Code:
if sys.version_info < (3, 5):
mybody = body.decode()
else:
mybody = body



Haben wir nen Command der auf Geräten mit Bildschirm Text einblendet?

Kommentar