Skip to main content

An API wrapper for KSP.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ksp.py-0.0.1.tar.gz (8.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page