aptible-api
Python client for api.aptible.com. Aptible's API is built on HAL+JASON so this package includes a simplified engine for generating Resource types based on JSON objects provided by the API / specifications in draft-kelly-json-hal-06
Installation
pip install aptible-api
Usage
Fist create an instance of the API
from aptible.api import AptibleApi
aptible_api = AptibleApi()
Then authorize the application via either account credentials or a token.
# Via account credentials
aptible_api.authorize(email='user@example.com', password='password')
# Via a token
from pathlib import Path
from json import JSONDecoder
tokens_path = Path('~/.aptible/tokens.json')
tokens_json = JSONDecoder.decode(tokens_path.read_text())
token = tokens_json['https://auth.aptible.com']
aptible_api.authorize(token=token)
From here, you can interact with the API however you wish.
accounts = aptible_api.accounts()
account = next(accounts)
account.handle
# >>> 'demo-account'
next(account.apps()).handle
# >>> 'foodle'
new_app = account.create_app(handle='foo-app')
new_app.href
# >>> 'https://api.aptible.com/apps/1337'
Contributing
- Fork the project.
- Commit your changes, with tests.
- Ensure that your code passes tests (
pipenv run py.test) and meets pylint style guide (pipenv run pylint). - Create a new pull request on GitHub.
Copyright
MIT License, see LICENSE for details.
Copyright (c) 2021 TrialSpark, Inc. and contributors.
Metadata
Release files for aptible-api 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aptible-api-0.4.0.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aptible_api-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.4 kB
Release files / aptible-api-0.4.0.tar.gz
| Download URL | aptible-api-0.4.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e23f5652c2b56e08e09458816a4bc4beaf9ff93271608d077ab9293825d0237c
|
|
BLAKE2b-256 checksum How to use checksums |
9521db79dfa884ae33dfa2a5cf52f95a2dbfcfcbcfd7e25c89646abcd8d01d9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.3
|
Release files / aptible_api-0.4.0-py3-none-any.whl
| Download URL | aptible_api-0.4.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66b7e8d94866cc01776c8fd7d586366e9f6e5302f847e39325ad2843885474c8
|
|
BLAKE2b-256 checksum How to use checksums |
d76a199dd2a13726847a6827e4ad296e6c53266480e3474bb965c517b11d651d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.3
|