Skip to content

Commit 1ec72c9

Browse files
authored
Merge pull request #2 from ByteInternet/move-functionality-to-public-client
move various methods to the open source client
2 parents bdb74a0 + 9a4d01d commit 1ec72c9

21 files changed

+1294
-12
lines changed

README.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,44 @@ pip install -e git+https://github.com/byteinternet/hypernode-api-python.git@mast
2727
```
2828
Of course you might want to put that in a `requirements.txt` file in your project instead of installing it manually.
2929

30+
### Performing API calls
31+
3032
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
3335

34-
In [2]: client = HypernodeAPIPython(token='yoursecrettoken')
36+
client = HypernodeAPIPython(token='yoursecrettoken')
3537

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+
```
3743

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+
```
4049

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+
)
4160
```
4261

62+
4363
## Development
4464

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
4868
```
4969

5070
## Related projects

0 commit comments

Comments
 (0)