Add number to fake downloaded photos

This commit is contained in:
Tanner Collin 2021-03-10 22:24:18 -07:00
parent 3c5855ecd3
commit be140b4c22

View File

@ -5,16 +5,16 @@ import paramiko
import time
paramiko.util.log_to_file('paramiko.log')
def fake_download(dest):
def fake_download(ip, dest):
import requests, random
rnd = str(random.randint(1, 10000))
r = requests.get('https://picsum.photos/400/300?random=' + rnd)
with open(dest / (rnd + '.jpg'), 'wb') as f:
num = ip.split('.')[3]
r = requests.get('https://picsum.photos/400/300?random=' + num)
with open(dest / (num + '_420.jpg'), 'wb') as f:
f.write(r.content)
def download(ip, dest):
if settings.DEBUG:
fake_download(dest)
fake_download(ip, dest)
print('Downloading from', ip)