Add number to fake downloaded photos
This commit is contained in:
parent
3c5855ecd3
commit
be140b4c22
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user