import requests
import uuid
import os
unique_filename = str(uuid.uuid1())
path = 'tmp_user/' + unique_filename + '.jpg'
def gen():
url = "https://thispersondoesnotexist.com/image"
response = requests.get(url)
if response.status_code == 200:
with open(path, 'wb') as f:
f.write(response.content)
input()
os.delete(path)