@@ -27,24 +27,44 @@ pip install -e git+https://github.com/byteinternet/hypernode-api-python.git@mast
27
27
```
28
28
Of course you might want to put that in a ` requirements.txt ` file in your project instead of installing it manually.
29
29
30
+ ### Performing API calls
31
+
30
32
Then to use the API client you can test out an example request in your Python repl:
31
- ``` bash
32
- [1]: from hypernode_api_python.client import HypernodeAPIPython
33
+ ``` python
34
+ from hypernode_api_python.client import HypernodeAPIPython
33
35
34
- In [2]: client = HypernodeAPIPython(token=' yoursecrettoken' )
36
+ client = HypernodeAPIPython(token = ' yoursecrettoken' )
35
37
36
- In [3]: response = client.get_app_flavor(' yourhypernodeappname' )
38
+ response = client.get_app_flavor(' yourhypernodeappname' )
39
+
40
+ response.json()
41
+ {' name' : ' 2CPU/8GB/60GB (Falcon S 202202)' , ' redis_size' : ' 1024' }
42
+ ```
37
43
38
- In [4]: response.json ()
39
- Out[4]: {' name' : ' 2CPU/8GB/60GB (Falcon S 202202)' , ' redis_size' : ' 1024' }
44
+ Using the Hypernode-API you can automate all kinds of cool things like configuring settings:
45
+ ``` python
46
+ client.set_app_setting(' yourhypernodeappname' , ' php_version' , ' 8.1' ).json()
47
+ {' name' : ' yourhypernodeappname' , ' type' : ' persistent' , ' php_version' : ' 8.1' , ... }
48
+ ```
40
49
50
+ To even performing acts of cloud automation, like scaling to the first next larger plan:
51
+ ``` python
52
+ client.xgrade(
53
+ ' yourhypernodeappname' ,
54
+ data = {
55
+ ' product' : client.get_next_best_plan_for_app_or_404(
56
+ ' yourhypernodeappname'
57
+ ).json()[' code' ]
58
+ }
59
+ )
41
60
```
42
61
62
+
43
63
## Development
44
64
45
- To run the unit tests you can us ` tox ` :
46
- ```
47
- tox
65
+ To run the unit tests you can use ` tox ` :
66
+ ``` bash
67
+ tox -r
48
68
```
49
69
50
70
## Related projects
0 commit comments