Skip to main content

pykagapi

Description:

pykagapi - a python wrapper for King Arthurs Gold-related APIs (KAG API v1 and KAG Stats API). Use it as you please, feel free to contribute!

Dependencies:

  • python 3.10+
  • requests
  • aiohttp (for async client)

Installation:

From source:

  • Install poetry
  • Clone this repo: git clone https://github.com/moonburnt/pykagapi.git
  • Enter project's directory: cd pykagapi
  • poetry install

From pypi:

  • pip install pykagapi

Example Usage:

Getting general api info:

from pykagapi import kag

with kag.get_client() as c:
    print(c.get_api_info())

Getting general api info asynchroniously:

from pykagapi import kag
import asyncio

async def main():
    async with kag.get_async_client() as c:
        print(await c.get_api_info())

asyncio.run(main())

Getting amount of currently active servers:

from pykagapi import kag

with kag.get_client() as c:
    servers_amount = len(kag.extra.get_active_servers()["serverList"])

print(f"There are currently {servers_amount} servers with players!")

Example output: There are currently 6 servers with players!

Currently unimplemented api calls:

KAG API:

  • Everything that isn't "get" requests, because Im just a regular player and dont have ability to upload or remove anything

KAGSTATS API:

  • https://kagstats.com/api/players/{id}/refresh, because it doesnt seem to do anything
  • Whatever I didnt notice while casually reading api's source codes

TODO:

  • Support for non-GET requests
  • Automated tests
  • Support for "limit"/"start" in list views of kagstats api
  • Make async client optional

LICENSE:

MIT

Metadata

Release files for pykagapi 0.4.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 pykagapi 0.4.0
File Size Uploaded Provenance Actions
pykagapi-0.4.0.tar.gz 7.3 kB Without provenance Details for pykagapi-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 19.0 kB

Release files / pykagapi-0.4.0.tar.gz

Download URL pykagapi-0.4.0.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f613b10077576b619746f0ceb2abcc1510061de99d413263dc5da83b7f50429d
BLAKE2b-256 checksum
How to use checksums
f9efc19fd0f962323d3c62da20096636825bca4f712b00a8c10113ba365a0247
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.5 Linux/5.15.133-1-MANJARO

Release files / pykagapi-0.4.0-py3-none-any.whl

Download URL pykagapi-0.4.0-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
074d4d7aacdea5abe51f251538a58a67f05d1961c9d8b07963bf84d117f6e9cd
BLAKE2b-256 checksum
How to use checksums
9766f5dfdfccc2ceda7b287b01af89d10b1be5f97e43b9c88bc2ebbf92f5287c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.5 Linux/5.15.133-1-MANJARO

Security for pykagapi 0.4.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