In this release we are publishing our official Python client for the Hypernode API. This hypernode-api-python API client is the Python equivalent of the official hypernode-api-php API client we published earlier.
This API client implements various methods which can be useful for automating tasks related to your Hypernode. With our API-first design philosophy we aim to make as much of what can be done in the Hypernode Control Panel possible to do as well directly using the API.
An example of one of the things you can do with the Python API client is upgrading your plan to the next biggest plan. This could be a useful feature you for example wanted to program something where you detect if the load of your Hypernode is above a certain threshold and then trigger an automated migration to a plan with more resources available.
client.xgrade( 'yourhypernodeappname', data={ 'product': client.get_next_best_plan_for_app_or_404( 'yourhypernodeappname' ).json()['code'] } )
If you wish to use the API to perform actions which can incur costs, remember to first toggle the ‘Schedule via CLI’ switch on the change plan page for this Hypernode first.
You can find the API token of your Hypernode in /etc/hypernode/hypernode_api_token
. Note that not all API functionality 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. For more examples of the functionality that this API client implements check out the code on github.