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