Skip to main content

pvoutput

PVOutput.org python API module. Works with the R2 API version spec here.

Get your API key from the account page on PVOutput

Example usage

Here's a quick code example:

    from pvoutput import PVOutput
    import json
    apikey = 'aaaaaabbbbbbccccccddddddeeeeeeffffffgggg'
    systemid = 12345
    pvo = PVOutput(apikey=apikey, systemid=systemid)
    print(json.dumps(pvo.check_rate_limit(), indent=2))

Will give you output like this:

    {
        "X-Rate-Limit-Remaining": "271",
        "X-Rate-Limit-Limit": "300",
        "X-Rate-Limit-Reset": "1570597200"
    }

There are more example code snippets in the examples directory.

Installing

Prod-ish usage

pip install pvoutput to install from pypi

Dev Install Things

python -m virtualenv .venv
source .venv/bin/activate
pip install uv
uv venv

Input validation

This is handled by the pvoutput.base.PVOutputBase.validate_data function.

It expects the input data and a dict of configuration parameters, which are described in the table below:

Field name Required Valid Types Description
type Yes Any This is a python type object to match against the field type.
required No bool This defines if the field is required.
description No Any This is currently unused, but typically holds the description from the PVOutput API Docs
donation_required No bool If set to true, and the user's not donated, it'll throw a DonationRequired exception if the user tries to use functionality that requires them to have donated. It's a whole thing.
maxlen No int Maximum length of the field. ie. if len(field) > maxlen: raise ValueError
maxval No int Maximum value of the field.
minval No int Minimum value of the field.
additional_validators No List[function] A list of functions to run against the field, which should throw exceptions if something's wrong.

An example configuration

"date_val": {
    "required": True,
    "description": "Date",
    "type": date,
    "donation_required": False,
    "additional_validators" : [
        validate_delete_status_date
    ]
}

Contributing / Testing

ruff, and mypy should all pass before submitting a PR.

License

MIT License (see LICENSE), don't use this for anything you care about - I don't provide a warranty at all, and it'll likely steal your socks and underfeed your dog.

Changelog

  • 0.0.1 Initial version
  • 0.0.2 2019-10-12 Fixed some bugs
  • 0.0.3 2019-10-13 Added PVOutput.getstatus() which returns the current status as a dict
  • 0.0.4 2019-11-05 Code cleanup using sonarqube, added an error check for registernotification
  • 0.0.5 Asyncio things
  • 0.0.6 I broke the build when uploading to pypi, fixed in 0.0.7.
  • 0.0.7 2021-12-27 #117 fix for getstatus issues
  • 0.0.8 2022-01-02 @cheops did great work cleaning up a lot of my mess, and testing is much better.
  • 0.0.10 2022-08-27 Added explicit timeouts to HTTP connections in the synchronous client.
  • 0.0.11 2022-08-27 Added explicit timeouts to HTTP connections in the aiohttp client.
  • 0.0.12 (pending) 2023-10-10 Adding addbatchstatus

Metadata

Release files for pvoutput 0.1.0

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

Source distribution (sdist)

Source distribution for pvoutput 0.1.0
File Size Uploaded Provenance
pvoutput-0.1.0.tar.gz 17.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 34.3 kB

Release files / pvoutput-0.1.0.tar.gz

Download URL pvoutput-0.1.0.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a2c5b8e99d8759b4386b5a387ff95900350b1ad46b49adef93134552666e4bbc
BLAKE2b-256 checksum
How to use checksums
7e2a040d0d62132e49f8ab12bbc0e93e79d77d644881442f5419a8ef13cf912a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.7

Release files / pvoutput-0.1.0-py3-none-any.whl

Download URL pvoutput-0.1.0-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dedd6307ee50f558d0150899ffd99af2475c3b173a974abc44729270c8826106
BLAKE2b-256 checksum
How to use checksums
80279f60ba9cdd8a33f1b46c3205ca0efa59524f7bef8aa3d0127b8a418eca94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.7

Security for pvoutput 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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