A wrapper to the Stackato Client API. Easy Peasy Lemon Squeezy. To read up more on the Stackato Client API, please see the documentation here.
pip install python-stackato
alternatively...
git clone https://github.com/bacongobbler/python-stackato
python setup.py install
Take a look at the examples/
folder for some real-life examples.
from stackato import Session
s = Session("https://api.stackato-xxxx.local/")
s.login("username", "password")
This is for when you have previously logged in and the token is stored within your client token file (hidden at ~/.stackato/client/token)
from stackato import Session
s = Session("https://api.stacka.to/")
if s.login():
print(s._get('info'))
from stackato import Session
# Spot the difference!
s = Session("https://api.stackato-xxxx.local/")
if s.login(store_token=True):
s.delete_app('demo')
from stackato import Session
s = Session("https://api.stackato-xxxx.local/")
if s.login():
print(s.get_app('demo').services)
from stackato import Session
s = Session("https://api.stackato-xxxx.local/")
if s.login():
app = s.get_app('demo')
app['instances'] += 1
# make a PUT request to the application
if s.put_app('demo', app):
print('added one more instance to this application.')
This will also work with _post(), _put(), and _delete(). You can also take a look at _request() if you want to make your own custom request call.
from stackato import Session
s = Session("https://api.stackato-xxxx.local/")
if s.login():
print(s._get('stackato/usage?all=1'))