Python tools for building Penn-related applications
Project description
Penn SDK is the Python library for writing code that interfaces with University of Pennsylvania data. It consists of wrappers for various APIs, including the Registrar, Dining, and Directory APIs.
Getting an API key
To use these libraries, you must first obtain an API token and password, which can be done here. There are separate API tokens and password for each of dining, registrar, news/events/maps, transit, and directory.
There is also a Laundry API and Calendar, which don’t need a key. The StudySpaces API requires a LibCal client ID and secret. The Fitness schedule API requires a key from TeamUp (https://teamup.com/api-keys/request).
Documentation
The full API documentation can be found at https://esb.isc-seo.upenn.edu/8091/documentation/.
Documentation for the wrapper can be found at http://penn-sdk.readthedocs.org/
Installation
You can install PennSDK easily using pip
$ sudo pip install PennSDK
easy_install also works
# sudo easy_install PennSDK
Getting Started
Once you have an API token and Password, you can use the wrapper as follows.
from penn import Registrar
REG_USERNAME = 'MY_REGISTAR_USERNAME'
REG_PASSWORD = 'MY_REGISTRAR_PASSWORD'
r = Registrar(REG_USERNAME, REG_PASSWORD)
cis120 = r.course('cis', '120')
# cis120 is a dictionary parsed from the API json
my_data = cis120['result_data']
All of other services (Dining, Directory, Transit, News, Map) follow this same basic format, except for the Laundry, Study Spaces, and Calendar API’s, which don’t need a username and password passed in at initialization. Refer to the wrapper documentation at http://penn-sdk.readthedocs.org/ for more info.
Running Tests
Once you have an API token and password, you can run the tests by creating a tests/credentials.py file with them as constants. Depending on what you want to test, include the following variables. They will be retrieved from your environment variables by default.
REG_USERNAME = 'MY_REGISTAR_USERNAME'
REG_PASSWORD = 'MY_REGISTAR_PASSWORD'
DIN_USERNAME = 'MY_DINING_USERNAME'
DIN_PASSWORD = 'MY_DINING_PASSWORD'
DIR_USERNAME = 'MY_DIRECTORY_USERNAME'
DIR_PASSWORD = 'MY_DIRECTORY_PASSWORD'
TRANSIT_USERNAME = 'MY_DIRECTORY_USERNAME'
TRANSIT_PASSWORD = 'MY_DIRECTORY_PASSWORD'
LIBCAL_ID = 'MY_LIBCAL_ID'
LIBCAL_SECRET = 'MY_LIBCAL_SECRET'
FITNESS_TOKEN = 'MY_FITNESS_TOKEN'
Then run make test to run all tests in your shell.
Contributing & Bug Reporting
If you find a bug, please submit it through the GitHub issues page.
Pull requests are welcome!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file PennSDK-1.8.9.tar.gz
.
File metadata
- Download URL: PennSDK-1.8.9.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04f4cacd1942e85ab7fa7d13f9994b8718573b91b7809567e20eaf020b2321a8 |
|
MD5 | 0f3877ccf0da54d613d030ae0e398861 |
|
BLAKE2b-256 | ed8256dd3f5bd7b719a894bd3886abc41f203b123cbd03872d2fa5179cc33ac7 |
File details
Details for the file PennSDK-1.8.9-py2-none-any.whl
.
File metadata
- Download URL: PennSDK-1.8.9-py2-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c2aff67a0f6730c254ae3a81727be39515308f59e0f02de5feeaffad832cff0 |
|
MD5 | a5dc66f4c29237667f00c4633f9049ac |
|
BLAKE2b-256 | dad7de13b6629f22a1806fd28f3c00f57918fa40e1ec6fafe614c3ad275a6780 |