A Python package to communicate with Stratocore's PUMAPI.
Project description
PyPPMS
PUMAPI - Python Interface
Stratocore's PPMS booking system offers an API (the so-called PUMAPI, short for PPMS Utility Management API) for fetching information from the booking system as well as changing its state and properties.
This is a Python 3 package for talking to the PUMAPI.
Usage Example
Fetch email addresses of all active users:
from pyppms import ppms
from credentials_ppms import PPMS_URL, PPMS_API_KEY
conn = ppms.PpmsConnection(PPMS_URL, PPMS_API_KEY)
print("Querying PPMS for emails of active users, can take minutes...")
emails = ppms.get_users_emails(active=True)
print(f"Got {len(emails)} email addresses from PPMS:")
print("\n".join(emails))
Testing
Automated testing is described in the TESTING
document on github.
Note
The PPMS API sometimes exposes a bit of a surprising behavior. During development of the package, we came across several issues (this list is certainly incomplete):
- HTTP status return code is always
200
, even on failed authentication. - Results of queries are a mixture of CSV (with headers) and and text with newlines (with no headers and therefore without structural information on the data). JSON is implemented in some cases only.
- The CSV headers sometimes do contain spaces between the colons, sometimes they don't.
- Some fields are quoted in the CSV output, some are not. Difficult to separate the values since there are colons in the values too.
- Semantics of keys is not consistent. Sometimes
user
is the user id, sometimes it refers to the user's full name. - Using an invalid permission level (e.g.
Z
) with thesetright
action is silently ignored by PUMAPI, the response is stilldone
even though this doesn't make any sense. - There is no (obvious) robust way to derive the user id from the user's full
name that is returned e.g. by
getrunningsheet
, making it very hard to cross-reference it with data fromgetuser
. - The result of the
getrunningsheet
query in general is not suited very well for automated processing, it seems to be rather tailored for humans and subject to (mis-) interpretation. - Unfortunately
Username
andSystemname
are not the unique id, they are rather the full description. Therefore sometimes looping over all users and systems is necessary. - Some results have a very strange format - for example, the starting time of the next booking is given as minutes from now instead of an absolute time.
- Official documentation is rather rudimentary, i.e. it contains almost no information on what is returned in case wrong / invalid parameters are supplied and similar situations.
References
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 pyppms-3.3.0.tar.gz
.
File metadata
- Download URL: pyppms-3.3.0.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.4 Linux/5.15.0-77-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f3f7f0dc4edc814578ba597cd1228f9cab74b8f33cb5156445f6c93c0891d86 |
|
MD5 | e247657c6805847c6a1bcda33009d326 |
|
BLAKE2b-256 | ba6db702d620175adf04613c0df80ad1a9cf26420e90827ce09a5f0810079878 |
File details
Details for the file pyppms-3.3.0-py3-none-any.whl
.
File metadata
- Download URL: pyppms-3.3.0-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.4 Linux/5.15.0-77-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d839fde9f37f7a33cdb6f510c2230a0c89618684a1b68282da656935c52af922 |
|
MD5 | e620431eade1c464bae0956c15df5ded |
|
BLAKE2b-256 | 15c011b99b35ca10c601034e06b728856a6415ac1d22efd4e8c55826d6c6bdc0 |