Hypernode API Python Client
Please note: this project is still in its early stages and the API may be subject to change.
Installation
git clone https://github.com/byteinternet/hypernode-api-python.git
cd hypernode-api-python
python3 -m venv venv
. venv/bin/activate
pip install -r requirements/development.txt
Usage
Acquiring an API token
Each Hypernode has an API token associated with it, you can use that to talk to the API directly. You can find the token in /etc/hypernode/hypernode_api_token. For API tokens with special permissions please contact support@hypernode.com. Not all functionality in the API is currently generally available but if you'd like to start automating and have an interesting use-case we'd love to hear from you.
Installing the library in your project
First make sure your project has the library installed:
pip install -e git+https://github.com/byteinternet/hypernode-api-python.git@master#egg=hypernode_api_python
Of course you might want to put that in a requirements.txt file in your project instead of installing it manually.
Alternatively, you can also install the hypernode-api-python library from PyPI:
$ python3 -m venv venv
$ . venv/bin/activate
$ pip install hypernode-api-python
$ pip freeze | grep hypernode-api-python
hypernode-api-python==0.0.6
Performing API calls
Then to use the API client you can test out an example request in your Python repl:
from hypernode_api_python.client import HypernodeAPIPython
client = HypernodeAPIPython(token='yoursecrettoken')
response = client.get_app_flavor('yourhypernodeappname')
response.json()
{'name': '2CPU/8GB/60GB (Falcon S 202202)', 'redis_size': '1024'}
Using the Hypernode-API you can automate all kinds of cool things like configuring settings:
client.set_app_setting('yourhypernodeappname', 'php_version', '8.1').json()
{'name': 'yourhypernodeappname', 'type': 'persistent', 'php_version': '8.1', ...}
To even performing acts of cloud automation, like scaling to the first next larger plan:
client.xgrade(
'yourhypernodeappname',
data={
'product': client.get_next_best_plan_for_app_or_404(
'yourhypernodeappname'
).json()['code']
}
)
Development
To run the unit tests you can use tox:
tox -r
Related projects
- The official Hypernode API PHP Client
- The official Hypernode Deploy tool
- The official Hypernode Docker image
Metadata
Release files for hypernode-api-python 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hypernode_api_python-0.0.6.tar.gz | 11.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hypernode_api_python-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.5 kB
Release files / hypernode_api_python-0.0.6.tar.gz
| Download URL | hypernode_api_python-0.0.6.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b2008473658bf98341107990971aff533b9bfb46c74a9a45e84a19eb6de9373
|
|
BLAKE2b-256 checksum How to use checksums |
1bc928ad4edd3da4f59e633c24173b3802ef7f15158607251bc7e9849bc163b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.4
|
Release files / hypernode_api_python-0.0.6-py3-none-any.whl
| Download URL | hypernode_api_python-0.0.6-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
081b6ab761c417e5f9170ebb98f351b98bc3d2ef5d814efdcd39b13f686c00a1
|
|
BLAKE2b-256 checksum How to use checksums |
72fb70de1e49e5b28223a466aefac3a9660b1fda234a252f3bbead77c7f1c82b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.4
|