Python interface to Stackato
Project description
Python-Stackato
===============
[![PyPi version](https://pypip.in/v/python-stackato/badge.png)](https://crate.io/packages/python-stackato/)
[![PyPi downloads](https://pypip.in/d/python-stackato/badge.png)](https://crate.io/packages/python-stackato/)
A wrapper to the Stackato Client API. Allows users to make requests to the Stackato API. Easy Peasy Lemon Squeezy.
To read up more on the Stackato Client API, please see the documentation [here](http://docs.stackato.com/api/client.html).
## 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
```python
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)
```python
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
```python
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
```python
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
```python
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.
```python
from stackato import Session
s = Session("https://api.stackato-xxxx.local/")
if s.login():
print(s._get('stackato/usage?all=1'))
```
===============
[![PyPi version](https://pypip.in/v/python-stackato/badge.png)](https://crate.io/packages/python-stackato/)
[![PyPi downloads](https://pypip.in/d/python-stackato/badge.png)](https://crate.io/packages/python-stackato/)
A wrapper to the Stackato Client API. Allows users to make requests to the Stackato API. Easy Peasy Lemon Squeezy.
To read up more on the Stackato Client API, please see the documentation [here](http://docs.stackato.com/api/client.html).
## 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
```python
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)
```python
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
```python
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
```python
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
```python
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.
```python
from stackato import Session
s = Session("https://api.stackato-xxxx.local/")
if s.login():
print(s._get('stackato/usage?all=1'))
```
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
python-stackato-1.4.tar.gz
(4.3 kB
view details)
File details
Details for the file python-stackato-1.4.tar.gz
.
File metadata
- Download URL: python-stackato-1.4.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9832b4f1bcea75061d6f0f2f96a7ebe18fa38287b5352d3b6871d994cf58aca2 |
|
MD5 | 46e1a5c173c62ad0c87aca1f81492b0b |
|
BLAKE2b-256 | f02bad9625d665830cc199a52cfa6dc1476ae830ed4e32004eb5ea582e806745 |