forked from codeformuenster/parking-decks-muenster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto_commit.py
35 lines (30 loc) · 1.09 KB
/
auto_commit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
automatic commit of daily parkleitsystem and waiting time data .csv file
"""
import os
import datetime
import config as cfg
def main():
"""
automatic commit of daily parkleitsystem data
and of daily waiting time data in the citizen center of Muenster
to github
"""
# get current date and time
now = datetime.datetime.today()
yesterday = now - datetime.timedelta(days=1)
date = yesterday.strftime('%Y-%m-%d')
filename = date + ".csv"
# print("Committing {}".format(filename))
filename_long_parkleitsystem = "data/" + filename
filename_long_waiting_time = "data_citizen_center/" + filename
add_command1 = 'git add ' + filename_long_parkleitsystem
add_command2 = 'git add ' + filename_long_waiting_time
commit_command = 'git commit -m "added parkleitsystem and waiting time data files"'
push_command = 'git push https://' + cfg.token + '@github.com/codeformuenster/parking-decks-muenster.git'
os.system(add_command1)
os.system(add_command2)
os.system(commit_command)
os.system(push_command)
if __name__ == "__main__":
main()