From 8784072d29355ed0c86759f7b7929e535b7e6965 Mon Sep 17 00:00:00 2001 From: Fredrik Wahlberg Date: Sun, 30 Jan 2022 12:08:29 +0100 Subject: [PATCH] Uppdaterar till Python3, steg 1 av flera --- cover.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cover.py b/cover.py index 55f76e5..2608bd6 100755 --- a/cover.py +++ b/cover.py @@ -1,7 +1,7 @@ from PIL import Image import ST7789 as ST7789 import RPi.GPIO as GPIO -import urllib2 as urllib +import urllib3 as urllib import requests import io import time @@ -27,9 +27,9 @@ uri = js2.json()['result']['uri'] # Second request gets the url for the cover image js3 = { "method": "core.library.get_images", "jsonrpc": "2.0", "params": { "uris": [uri] }, "id": 1} js4 = requests.post(url, json=js3) -cover = js4.json()['result'].values()[0][0]['uri'] +cover = list(js4.json()['result'].values())[0][0]['uri'] -fd = urllib.urlopen(cover) +fd = requests.urlopen(cover) image_file = io.BytesIO(fd.read()) WIDTH = disp.width