This commit is contained in:
E 2021-03-10 22:33:22 -07:00
commit 5f8aad7355

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)