from selenium import webdriver import AutoTicket import AutoColor2 import json import os import datetime import time urls = {"NOC-PROV": "", "NOC-PROV-ADV" : "", "PROV-DSL" : "", "PROV-FIBER":"", "PROV-IPBB":"","PROV-MISC":"","FUS-PROV":"","TICKETS":""} tickets_sorted = False def assign_urls(dictionary): for key in dictionary: value = input(f"Enter url for '{key}': ") dictionary[key] = value def get_team(): user_list = [] print("What are the usernames?") while True: user_input = input("Add to list (Press Enter to finish): ") if user_input: user_list.append(user_input.lower()) else: break print("I'm working with these users:", user_list) print("") print("This look good? y/n") answer = input() if "n" in answer: print("Let's try that again...") print("") get_team() else: return user_list def first_time_setup(): print("Initiating first time set up") print("To ensure internal security, you will need to provide urls for each location,") print("As well as employee usernames (first.last)") print("If you don't know, you shouldn't be using this script.") assign_urls(urls) with open('urls.json', 'w') as file: json.dump(urls, file) users = get_team() with open('team.json', 'w') as file: json.dump(users, file) def main(): if os.path.exists('urls.json'): print("Skipping first time setup") else: first_time_setup() driver = webdriver.Firefox() with open('urls.json', 'r') as file: urls = json.load(file) with open('team.json', 'r') as file: users = json.load(file) while True: current_time = datetime.datetime.now().time() start_time = datetime.time(9, 0, 0) end_time = datetime.time(17, 0, 0) if start_time <= current_time <= end_time: AutoTicket.auto_ticket(urls, users, driver, tickets_sorted) AutoColor2.tag_assist(urls, driver, users) else: print("It's after hours. I'm not doing anything.") time.sleep(7200) # Sleep for 2 hours #driver.close() main()