Door code.
A proof-of-concept to pull information from a google spreadsheet. This will eventually be used to create a list of cards to add, activate, or deactivate.
install the Google API python client: pip install --upgrade google-api-python-client
Requires a configs/hackerdoor-servicecredentials.json file containing the Service API Account credentials for the google sheet you want to access. It is in the shape of:
{
"type": "service_account",
"project_id": "foo",
"private_key_id": "foo",
"private_key": "foo",
"client_email": "[email protected]",
"client_id": "1234",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "foo"
}
Simply call python -m googleapi.memberlist
to run the small script. It will pull the current active member members and their card information, such as:
Name, Status, FC, CC, Dec
Harry Hacker, ACTIVE, 22, 33, 000001234
Margert Maker, ACTIVE, 00, 11, 000004567
The FC, CC, and DEC are components of the card number. The DEC is the decimal equivalent of the FC and CC values.
Unit Tests are written using the standard library unittest, and can be ran be using the following command
python -m unittest discover -v -p "*test.py"
The naming convention for test files in this project is foo_test.py
. By default, python's unittest uses a nameing convention of test_foo.py
, but that moves test files away from the modules they are meant to be testing, so a different convention has been choosen.