Repozitář pro studenty IVE
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

14 lines
379 B

import requests
from PIL import Image
response = requests.get("https://yesno.wtf/api")
if response.status_code == 200:
data = response.json()
print(data["answer"])
image_url = data["image"]
image_response = requests.get(image_url)
with open("image.gif","wb") as f:
f.write(image_response.content)
image = Image.open("image.gif")
image.show()