Skip to main content

pmhclib

PyPI Version

pmhclib is a Python wrapper for the unofficial PMHC MDS portal API. You can use it to automate uploads and downloads to the PMHC portal.

Install

pmhclib is a Python package. You should be able to install it directly with pip or poetry:

pip install pmhclib

OR

poetry add pmhclib

This will install pmhclib as an importable Python library.

Usage

pmhclib.PMHC is intended to be used with a context manager. This ensures that the requests session which performs the login process and the API requests is correctly closed when the script exits. The standard use pattern is as follows:

from pmhclib import PMHC
with PMHC('PHN105') as pmhc:
    pmhc.login()
    ...
    # other pmhc methods.

pmhc.login() will read credentials from the following environment variables if they are set:

PMHC_USERNAME
PMHC_PASSWORD
PMHC_TOTP_SECRET

Otherwise, you will be prompted for credentials interactively.

In PowerShell, you can set the environment variables interactively as follows:

$env:PMHC_USERNAME='your_username_here'
$env:PMHC_PASSWORD=python -c 'import getpass; print(getpass.getpass())'
$env:PMHC_TOTP_SECRET=python -c 'import getpass; print(getpass.getpass("TOTP Secret: "))'

In a Unix shell (Mac, Linux), you can do:

export PMHC_USERNAME='your_username_here'
read -rs PMHC_PASSWORD && export PMHC_PASSWORD
read -rs PMHC_TOTP_SECRET && export PMHC_TOTP_SECRET

NOTE: PMHC_TOTP_SECRET is the unchanging base32-encoded TOTP secret, not the time-based six-digit code. You can likely find this secret in the 'advanced' section of your TOTP app. It will be a long string of upper-case letters and digits. See below for a list of TOTP apps which support viewing the TOTP secret. It is also possible to get the secret by scanning the setup QR code with a generic QR code reader, or by clicking the Trouble scanning button on the website to manually configure the TOTP app:

manually view totp secret

The six-digit code will be automatically calculated based on the current time as required if PMHC_TOTP_SECRET is specified. Otherwise, the user will be prompted to enter the current six-digit code.

Not all TOTP apps support viewing the secret. The following are known to support this:

For more details, see the list of recommended authenticator apps on our Data Wiki.

Documentation

See the online documentation.

Built-in docs

Review the built-in documentation from Python as follows:

>>> from pmhclib import PMHC
>>> help(PMHC)

Build docs

You can also generate html documentation locally using Sphinx if you have a local copy of the repository.

Linux:

cd docs
make html

PowerShell:

cd docs
./make.bat html

The generated documentation can be viewed at docs/_build/html/index.html.

Metadata

Release files for pmhclib 0.9.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pmhclib 0.9.2
File Size Uploaded Provenance Actions
pmhclib-0.9.2.tar.gz 11.3 kB With provenance Details for pmhclib-0.9.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pmhclib 0.9.2
File Interpreter ABI Platform Actions
pmhclib-0.9.2-py3-none-any.whl Python 3 none any Details for pmhclib-0.9.2-py3-none-any.whl

Total release size: 22.4 kB

Release files / pmhclib-0.9.2.tar.gz

Download URL pmhclib-0.9.2.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
62019afa789f05841402662a63b4171557818bed944963ef02e5017d8bf8a158
BLAKE2b-256 checksum
How to use checksums
930a2e95eb1648114c5e6cf0434d67498a0ef5371e72d49537cc7246ea82929c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / pmhclib-0.9.2-py3-none-any.whl

Download URL pmhclib-0.9.2-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63610313a5235a6af9103d60f56254adb53900e8d487c92f62a32eaa290ffcea
BLAKE2b-256 checksum
How to use checksums
5a9cc8f672a4370993d6918da3d2a0ed6805ce73da9c6c854eb5c1bf9f0dd01d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for pmhclib 0.9.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pmhclib-0.9.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page