Accepts arguments to be used with multiple cron scripts

This commit is contained in:
dan
2023-11-21 11:23:48 -05:00
parent 57385924db
commit 878c13d0c1

View File

@@ -1,11 +1,12 @@
import requests import requests
import datetime import datetime
import sys
url = 'http://192.168.86.207:5000/snapshot/plants.jpg' url = sys.argv[1]
data = requests.get(url).content data = requests.get(url).content
path = sys.argv[2]
fn = datetime.datetime.now().strftime("%Y%m%d%H%M") fn = datetime.datetime.now().strftime("%Y%m%d%H%M")
with open(fn + '.jpg', 'wb') as f: with open(path + fn + '.jpg', 'wb') as f:
f.write(data) f.write(data)