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 details)

Uploaded Source

File details

Details for the file ksp.py-0.0.1.tar.gz.

File metadata

  • Download URL: ksp.py-0.0.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for ksp.py-0.0.1.tar.gz
Algorithm Hash digest
SHA256 98bb600faebb91c0c591536448f7deb07299aba32bf0e7450e42679233147fd7
MD5 57592361de63d7ae41885e101f73846f
BLAKE2b-256 001ff265fdb344466c4b4ce1ad8bec3cc97655704e75fe3358d448d59649a7a2

See more details on using hashes here.

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