Skip to content

adam757521/ksp.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ksp.py


Documentation

An API wrapper for KSP.

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