Im brand new to python and im working on a script to run to automatically download some files from a set of URL's. In these URL's i have put brackets that I have defined since these 3 lines in the url needs to changed (1 unix timestamp, start date and end date). This is all fixed.
Now ive gotten it to work with the following:
- Code: Select all
def get_file(url, filename):
end_date = datetime.now().strftime("%Y-%m-%d")
start_date = datetime.now()-timedelta(days=7)
start_date = start_date.strftime("%Y-%m-%d")
current_timestamp = int(time())
formatted_url = url.format(current_timestamp, start_date, end_date)
data = requests.get(formatted_url)
with open(filename, "wb") as f:
This takes todays date and 7 days in the past.
Now what i would like to do is change this to be changeable? So I can set my own dates instead.
Eventually I want to make a GUI on this (I have no idea where to start with the GUI but ill get there eventually!).
Any ideas on how i cancode this so that I can choose dates?
It would be prefered that in the code I just open it and then have a certain string i manually set the date and then run the script.
I may be rambling but hopefully someone knows what to do.