forked from CMS/memberPlumbing
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
from ruamel.yaml import YAML
|
|
import urllib3
|
|
import os
|
|
from hid.DoorController import DoorController
|
|
|
|
from passwords import DOOR_USERNAME, DOOR_PASSWORD
|
|
from passwords import MEMBERSHIPWORKS_USERNAME, MEMBERSHIPWORKS_PASSWORD
|
|
|
|
from MembershipWorks import MembershipWorks
|
|
# it's fine, ssl certs are for losers anyway
|
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
|
|
try:
|
|
with open(os.path.dirname(os.path.abspath(__file__)) + "/config.yaml") as f:
|
|
config = YAML().load(f)
|
|
except NameError:
|
|
with open("config.yaml") as f:
|
|
config = YAML().load(f)
|
|
|
|
doors = {doorName: DoorController(doorData['ip'],
|
|
DOOR_USERNAME, DOOR_PASSWORD,
|
|
name=doorName, access=doorData['access'])
|
|
for doorName, doorData in config["doors"].items()}
|
|
|
|
memberLevels = config['memberLevels']
|
|
doorSpecificSchedules = config['doorSpecificSchedules']
|
|
|
|
membershipworks = MembershipWorks()
|
|
membershipworks.login(MEMBERSHIPWORKS_USERNAME, MEMBERSHIPWORKS_PASSWORD)
|