Skip to main content

nadypy

A client library for accessing a Nadybot's API.

Installation

From PyPi:

pip install nadypy

From GitHub:

pip install git+https://github.com/Nadybot/nadypy.git

Usage

First, create a client:

from nadypy import Client

client = Client(base_url="http://localhost:8080/api")

If the endpoints you're going to hit require authentication (this currently applies to all endpoints), use either a BasicAuthClient or a SignedAuthClient instead.

BasicAuthClient uses credentials acquired via !webauth, which are not valid permanently:

from nadypy import BasicAuthClient

client = BasicAuthClient(base_url="http://localhost:8080/api", username="Character", password="password")

SignedAuthClient uses private keys as explained here:

from nadypy import SignedAuthClient

signed_auth_client = SignedAuthClient(
    "http://localhost:8080/api",
    key_id="bd879e20",
    private_key="""\
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEINca+XgCZoLXuu6p77cphsIxMiSaG09tBH6SV9AgEH4ioAoGCCqGSM49
AwEHoUQDQgAEPnzqwJq/el8kyNSPmYhQJ0L2qrMFtM3XDbAHrTQlXbFN2G8NmMBp
i52oubVjuTSHol1BQf4Haftbt0oBvHGUIw==
-----END EC PRIVATE KEY-----
""",
)

Now call your endpoint and use your models:

from typing import Optional

from nadypy.models import SystemInformation
from nadypy.api.system import get_sysinfo
from nadypy.types import Response

sysinfo: Optional[SystemInformation] = get_sysinfo.sync(client=client)
# or if you need more info (e.g. status_code)
response: Response[SystemInformation] = get_sysinfo.sync_detailed(client=client)

Or do the same thing with an async version:

from typing import Optional

from nadypy.models import SystemInformation
from nadypy.api.system import get_sysinfo
from nadypy.types import Response

sysinfo: Optional[SystemInformation] = await get_sysinfo.asyncio(client=client)
# or if you need more info (e.g. status_code)
response: Response[SystemInformation] = await get_sysinfo.asyncio_detailed(client=client)

Metadata

Release files for nadypy 5.2.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 nadypy 5.2.2
File Size Uploaded Provenance Actions
nadypy-5.2.2.tar.gz 22.4 kB Without provenance Details for nadypy-5.2.2.tar.gz

Built distribution (wheel)

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

Total release size: 94.9 kB

Release files / nadypy-5.2.2.tar.gz

Download URL nadypy-5.2.2.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c51e33da975b906f67f059864602297c4e0e62f629a73814ee36fa9a8b5c6cfe
BLAKE2b-256 checksum
How to use checksums
d21d3730eff6ddbcb3cc9d17116339f0a0c7b64a081e05ad200d05f4304bdad9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.9.7 Linux/5.14.11-200.fc34.x86_64

Release files / nadypy-5.2.2-py3-none-any.whl

Download URL nadypy-5.2.2-py3-none-any.whl
Size 72.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f3f6b3160f987fbc634de6e1b84f57d5525321a6af24c78b995e69463d302a2
BLAKE2b-256 checksum
How to use checksums
ead8e44177e3b56ca846a83385b4ef74667bf91a6c514e0ca0dece6f6d7369e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.9.7 Linux/5.14.11-200.fc34.x86_64

Security for nadypy 5.2.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.

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