/IITLookup

A Python 3 class for interacting with a subset of the most useful methods exposed by the CBORD Odyssey auxiliary web service.

Primary LanguagePythonMIT LicenseMIT

A Python 3 class for interacting with a subset of the most useful methods exposed by the CBORD Odyssey auxiliary web service.

Requirements: Python 3.x (may work on 2.x but untested on such), pysimplesoap git commit 0001fcee or newer (for standard version), mysqlclient (for local version)

Example Usage (A_NUMBER, 5_DIGIT_CARD_NUMBER and API_URL are substitutions of the actual values for privacy reasons):
        >>> from IITLookup import IITLookup
        >>> i = IITLookup("API_URL")
        >>> i.nameByID("A_NUMBER")
        {'first_name': 'Nash', 'middle_name': 'K.', 'last_name': 'Kaminski', 'id_number': 'A_NUMBER'}
        >>> i.nameIDByCard("5_DIGIT_CARD_NUMBER")
        {'first_name': 'Nash', 'middle_name': 'K.', 'idnumber': 'A_NUMBER', 'last_name': 'Kaminski'}
        >>> i.inquiryByID("A_NUMBER")
        {'Block Meals': {'blocked': False, 'balance': 0.0, 'limit': 0.0}, 'Auxiliary Points': {'blocked': False, 'balance': 0.0, 'limit': 0.0}, 'Kent Printing': {'blocked': False, 'balance': 0.0, 'limit': 0.0}, 'Bonus Points': {'blocked': False, 'balance': 0.0, 'limit': 0.0}, 'LaundryCash': {'blocked': False, 'balance': 100.0, 'limit': 0.0}, 'TechCash': {'blocked': False, 'balance': 0.0, 'limit': 0.0}, 'Sodexo Rewards': {'blocked': False, 'balance': 0.0, 'limit': 0.0}}
        >>> i.inquiryByCard("5_DIGIT_CARD_NUMBER")
        {'Block Meals': {'blocked': False, 'balance': 0.0, 'limit': 0.0}, 'Auxiliary Points': {'blocked': False, 'balance': 0.0, 'limit': 0.0}, 'Kent Printing': {'blocked': False, 'balance': 0.0, 'limit': 0.0}, 'Bonus Points': {'blocked': False, 'balance': 0.0, 'limit': 0.0}, 'LaundryCash': {'blocked': False, 'balance': 100.0, 'limit': 0.0}, 'TechCash': {'blocked': False, 'balance': 0.0, 'limit': 0.0}, 'Sodexo Rewards': {'blocked': False, 'balance': 0.0, 'limit': 0.0}}

Also included is an implementation of the nameByID and nameIDByCard accessor functions that interact directly with a MySQL/MariaDB instance of the user's choosing in IITLookupLocal.py Two additional functions, insertRecord and deleteRecord are also implemented in the local version only to assist with updating the database records. Usage is as follows:

<instance>.insertRecord('firstname','middlename','lastname','idnumber',cardnumber)
<instance>.deleteRecord('idnumber')

These methods return the number of database rows affected.

Initial SQL table schema is specified in sql_schema.sql

All accessor methods will return None if the requested record is not found.