Move hid/*.py and MembershipWorks.py to lib folder

This commit is contained in:
Adam Goldsmith 2020-02-06 17:54:33 -05:00
parent c52b76534c
commit 9d743344ab
6 changed files with 10 additions and 18 deletions

View File

@ -1,15 +1,12 @@
from ruamel.yaml import YAML from ruamel.yaml import YAML
import urllib3
import os import os
from hid.DoorController import DoorController
from lib.hid.DoorController import DoorController
from lib.MembershipWorks import MembershipWorks
from passwords import DOOR_USERNAME, DOOR_PASSWORD from passwords import DOOR_USERNAME, DOOR_PASSWORD
from passwords import MEMBERSHIPWORKS_USERNAME, MEMBERSHIPWORKS_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: try:
with open(os.path.dirname(os.path.abspath(__file__)) + "/config.yaml") as f: with open(os.path.dirname(os.path.abspath(__file__)) + "/config.yaml") as f:
config = YAML().load(f) config = YAML().load(f)

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from common import doors, membershipworks, memberLevels, doorSpecificSchedules from common import doors, membershipworks, memberLevels, doorSpecificSchedules
from hid.Credential import Credential from lib.hid.Credential import Credential
from hid.DoorController import ROOT, E from lib.hid.DoorController import ROOT, E
class Member(): class Member():
def __init__(self, forename="", surname="", membershipWorksID="", def __init__(self, forename="", surname="", membershipWorksID="",

View File

@ -1,10 +0,0 @@
#!/usr/bin/env python3
from common import doors
def forEachDoor(fxn):
for door in doors.values():
print(door.name)
fxn(door)
#forEachDoor(lambda door: door.sendCardFormat("A901146A-244", 1, 244))
#forEachDoor(lambda door: door.sendSchedules())

View File

@ -1,5 +1,6 @@
import csv import csv
from io import StringIO from io import StringIO
import urllib3
import requests import requests
from lxml import etree from lxml import etree
@ -14,6 +15,10 @@ ROOT = E_plain.VertXMessage
fieldnames = "CardNumber,CardFormat,PinRequired,PinCode,ExtendedAccess,ExpiryDate,Forename,Initial,Surname,Email,Phone,Custom1,Custom2,Schedule1,Schedule2,Schedule3,Schedule4,Schedule5,Schedule6,Schedule7,Schedule8".split(",") fieldnames = "CardNumber,CardFormat,PinRequired,PinCode,ExtendedAccess,ExpiryDate,Forename,Initial,Surname,Email,Phone,Custom1,Custom2,Schedule1,Schedule2,Schedule3,Schedule4,Schedule5,Schedule6,Schedule7,Schedule8".split(",")
# TODO: where should this live?
# it's fine, ssl certs are for losers anyway
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class RemoteError(Exception): class RemoteError(Exception):
def __init__(self, r): def __init__(self, r):
super().__init__( super().__init__(