Skip to main content

ksp.py


Documentation

An API wrapper for KSP.
The documentation is not done yet.

Features

  • Fetch full product data easily (includes stock, tags, price, etc)
  • Look for queries easily. (MORE COMING SOON)

Installation

Installing ksp.py is very easy.

python -m pip install ksp.py

Examples

Simple product stock viewer.

import time

import ksp

client = ksp.Client(ksp.Languages.ENGLISH)
cache = []

while True:
    product = client.get_product(...)

    if product and product.stock:
        available_branches = [
            branch for branch, status in product.stock.items() if status
        ]

        for branch in available_branches:
            if branch not in cache:
                print(f"Branch '{branch}' has been resupplied!")

        for branch in cache:
            if branch not in available_branches:
                print(f"Branch '{branch}' ran out of stock!")

        cache = available_branches

    time.sleep(2)

TODO

  • Add async support.

Known Issues

  • Currently, None!

Incase you do find bugs, please create an issue or a PR.

Support

Release files for ksp.py 0.0.1

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

Source distribution (sdist)

Source distribution for ksp.py 0.0.1
File Size Uploaded
ksp.py-0.0.1.tar.gz 8.1 kB Details

Release files / ksp.py-0.0.1.tar.gz

Download URL ksp.py-0.0.1.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
98bb600faebb91c0c591536448f7deb07299aba32bf0e7450e42679233147fd7
BLAKE2b-256 checksum
How to use checksums
001ff265fdb344466c4b4ce1ad8bec3cc97655704e75fe3358d448d59649a7a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.6

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

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