Browse Source

fix image download

rorist 2 months ago
parent
commit
27893ddb76
1 changed files with 2 additions and 6 deletions
  1. 2 6
      screend.py

+ 2 - 6
screend.py

@@ -101,15 +101,11 @@ def clock():
         time.sleep(1)
 
 def random_image():
-    #URL='http://aws.random.cat/meow'
     URL='https://picsum.photos/640/480'
     while True:
-        j = requests.get(URL).json()
-        response = requests.get(j['file'], stream=True)
+        response = requests.get(URL).content
         handle = open('./random_image.jpg', "wb")
-        for chunk in response.iter_content(chunk_size=512):
-            if chunk:
-                handle.write(chunk)
+        handle.write(response)
         handle.close()
         time.sleep(60)