A powerful spacetraders API
Project description
Autotraders
A spacetraders API focused on automation and ease of use
Usage
First you need a client, which can be generated
import requests
class BearerAuth(requests.auth.AuthBase):
def __init__(self, token):
self.token = token
def __call__(self, r):
r.headers["authorization"] = "Bearer " + self.token
return r
token = TOKEN_HERE
s = requests.Session()
s.auth = BearerAuth(token)
And now you're all set to use they actual API.
Ships
from autotraders.ships import Ship
# create a session here
ship = Ship("SYMBOL-Here", session) # This makes an API request
ship.dock()
ship.refuel()
ship.orbit() # All these functions make API calls (one each), but the line below doesn't
print(ship.fuel.current + "/" + ship.fuel.total)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
autotraders-0.2.0.tar.gz
(5.4 kB
view hashes)
Built Distribution
Close
Hashes for autotraders-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b99ba2026d3902210e0525c5dabf0bb45a910b7c6de47d4e8157bfc9c6deba2d |
|
MD5 | c2586367f00690f377e6ffcb6b9d855f |
|
BLAKE2b-256 | 4efb15af797e341c22d9a4e7d535c39d91b2a49ef220ab199ba3e0d24785b37d |