30 lines
530 B
Python
30 lines
530 B
Python
from PMT import PMT
|
|
from DB import Database
|
|
from dotenv import load_dotenv
|
|
import os
|
|
|
|
def main():
|
|
# Load the environment
|
|
load_dotenv(override=True)
|
|
|
|
|
|
# Set up database, webserver and PMT connection
|
|
db = Database()
|
|
pmt = PMT()
|
|
|
|
|
|
# fetch PMT shifts
|
|
pmt.login()
|
|
|
|
days_ahead = int(os.environ.get("DAYS_TO_FETCH"))
|
|
shifts = pmt.get_shifts(days_ahead)
|
|
PMT.print_shifts(shifts)
|
|
|
|
|
|
# Insert those shifts into the database
|
|
db.insert_shifts(shifts)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|