Skip to content
This repository has been archived by the owner. It is now read-only.

bacongobbler/python-stackato

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Python-Stackato

PyPi version PyPi downloads

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.

Installation

pip install python-stackato

alternatively...

git clone https://github.com/bacongobbler/python-stackato
python setup.py install

Usage

Take a look at the examples/ folder for some real-life examples.

Logging into the client

from stackato import Session

s = Session("https://api.stackato-xxxx.local/")
s.login("username", "password")

Passwordless Authentication

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

Storing the authentication token locally, and deleting an app

from stackato import Session

# Spot the difference!
s = Session("https://api.stackato-xxxx.local/")

if s.login(store_token=True):
    s.delete_app('demo')

Lisng all services bound to an app

from stackato import Session

s = Session("https://api.stackato-xxxx.local/")

if s.login():
    print(s.get_app('demo').services)

Forcing your app to increase its number of instances by one

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.')

Making a custom GET request

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

About

A python library to connect to Stackato

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages