E 3 years ago
commit 5f8aad7355
  1. 10
      server/download.py

@ -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)

Loading…
Cancel
Save