Python-Stackato
===============
[](https://crate.io/packages/python-stackato/)
[](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'))
```
===============
[](https://crate.io/packages/python-stackato/)
[](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'))
```
Metadata
Release files for python-stackato 1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python-stackato-1.4.tar.gz | 4.3 kB | Details |
Release files / python-stackato-1.4.tar.gz
| Download URL | python-stackato-1.4.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9832b4f1bcea75061d6f0f2f96a7ebe18fa38287b5352d3b6871d994cf58aca2
|
|
BLAKE2b-256 checksum How to use checksums |
f02bad9625d665830cc199a52cfa6dc1476ae830ed4e32004eb5ea582e806745
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |