Initial commit
This commit is contained in:
75
AssignerPal.py
Normal file
75
AssignerPal.py
Normal file
@@ -0,0 +1,75 @@
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.support.wait import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.common.action_chains import ActionChains
|
||||
import AutoTicket
|
||||
import AutoColor
|
||||
import json
|
||||
import os
|
||||
|
||||
urls = {"NOC-PROV": "", "NOC-PROV-ADV" : "", "PROV-DSL" : "", "PROV-FIBER":"", "PROV-IPBB":"","PROV-MISC":"","FUS-PROV":"","TICKETS":""}
|
||||
|
||||
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 choice(urls,users,driver):
|
||||
print("Tickets or Directly?")
|
||||
user_choice = input()
|
||||
if "ti" in user_choice.lower():
|
||||
AutoTicket.auto_ticket(urls,users,driver)
|
||||
if "di" in user_choice.lower():
|
||||
AutoColor.tag_assist(urls,driver)
|
||||
print("More?")
|
||||
if input("y/n : ") == "y":
|
||||
choice(urls,users,driver)
|
||||
|
||||
def main():
|
||||
if os.path.exists('urls.json'):
|
||||
print("Do first time set up?")
|
||||
if input("y/n : ") == "y":
|
||||
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)
|
||||
choice(urls,users,driver)
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user