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.0.post2

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.0.post2
File Size Uploaded
pmhclib-0.9.0.post2.tar.gz 11.3 kB Details

Built distribution (wheel)

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

Total release size: 22.6 kB

Release files / pmhclib-0.9.0.post2.tar.gz

Download URL pmhclib-0.9.0.post2.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
14d94015915d8fb1bbcf7ffa3b922cb72a62463360e6e049e0f0f418a6721bd2
BLAKE2b-256 checksum
How to use checksums
e38b713a04f7f372b0c56a6a6589689f5d4f6ddb8aed2301c1800acae6aeb200
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Release files / pmhclib-0.9.0.post2-py3-none-any.whl

Download URL pmhclib-0.9.0.post2-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b24fca099313466630899ef41657ab45db0ece69fc21e14672e5d27fd3560d04
BLAKE2b-256 checksum
How to use checksums
db78d3d0f0398ad62828a7ffba0be3370deaf66bb6e46406b15f3aa2cf3053c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Release history Release notifications | RSS feed

0.9.1

2 release files

This release

0.9.0.post2 This release

2 release files

0.9.0

2 release files

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