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
pip install aptible-api
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='[email protected]', 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'
- 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.
MIT License, see LICENSE for details.
Copyright (c) 2021 TrialSpark, Inc. and contributors.