Skip to content

Commit e2de5f3

Browse files
committed
Update Examples
1 parent a4f02fb commit e2de5f3

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

.github/workflows/build.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,13 @@ jobs:
5555
python -m build
5656
5757
- name: "List Artifacts"
58-
env:
59-
path: ${{ inputs.path }}
58+
working-directory: ${{ inputs.path }}
6059
run: |
61-
echo "::group::ls"
62-
ls -lAhR "${path}"
63-
echo "::endgroup::"
64-
echo "::group::tree"
65-
tree "${path}"
60+
results="$(tree . || ls -lAhR .)"
61+
echo "::group::results"
62+
echo "${results}"
6663
echo "::endgroup::"
67-
results="$(tree "${path}")"
68-
markdown='Artifacts:\n```text\n'"${results}"'\n```'
64+
markdown='Artifacts: `${{ inputs.path }}`\n```text\n'"${results}"'\n```'
6965
echo -e "${markdown}" >> $GITHUB_STEP_SUMMARY
7066
7167
- name: "Upload to Actions"

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Python 3 wrapper for the Vultr API v2.
3939
Vultr API Reference: [https://www.vultr.com/api](https://www.vultr.com/api/?ref=6905748)
4040

4141
> [!TIP]
42-
> This project is not complete, but has many useful functions.
4342
> Please submit a [Feature Request](https://github.com/cssnr/vultr-python/discussions/categories/feature-requests)
4443
> or report any [Issues](https://github.com/cssnr/vultr-python/issues).
4544
@@ -62,12 +61,11 @@ python -m pip install vultr-python
6261

6362
## Usage
6463

65-
You will need to create an api key and whitelist your IP address.
66-
Most functions do not work without an API Key.
64+
You will need to create an api key and whitelist your IP address for most functions.
6765

6866
- [https://my.vultr.com/settings/#settingsapi](https://my.vultr.com/settings/#settingsapi)
6967

70-
Initialize the class with your API Key or with the `VULTR_API_KEY` environment variable.
68+
Initialize the `Vultr` class with your API Key or use the `VULTR_API_KEY` environment variable.
7169

7270
```python
7371
from vultr import Vultr
@@ -112,16 +110,23 @@ instance = vultr.create_instance(available[0], plan, **data)
112110
Arbitrary Methods `get`, `post`, `patch`, `delete`
113111

114112
```python
115-
# vultr.get('url', params)
116-
instances = vultr.get('instances', {'type': 'vc2'})
117-
# vultr.post('url', **kwargs)
113+
plans = vultr.get('plans', {'type': 'vc2'})
118114
sshkey = vultr.post('ssh-keys', name='key-name', ssh_key='ssh-rsa AAAA...')
119-
# vultr.delete('url')
115+
instance = vultr.patch('instances', plan=plans[1]['id'])
120116
vultr.delete(f"instances/019ad1a8-2aa3-7650-83d1-8520d65ed6af")
121117
```
122118

123119
Error Handling
124120

121+
```python
122+
>>> instance = vultr.create_instance("atl", "vc2-1c-0.5gb-v6", **data)
123+
Traceback (most recent call last):
124+
...
125+
vultr.vultr.VultrException: Error 400: Server add failed: Ubuntu 24.04 LTS x64 requires a plan with at least 1000 MB memory.
126+
```
127+
128+
Using the `VultrException` class
129+
125130
```python
126131
from vultr import VultrException
127132

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ instance = vultr.create_instance(available[0], plan, **data)
8888
Arbitrary Methods `get`, `post`, `patch`, `delete`
8989

9090
```python
91-
instances = vultr.get('instances', {'type': 'vc2'})
91+
plans = vultr.get('plans', {'type': 'vc2'})
9292
sshkey = vultr.post('ssh-keys', name='key-name', ssh_key='ssh-rsa AAAA...')
93+
instance = vultr.patch('instances', plan=plans[1]['id'])
9394
vultr.delete(f"instances/019ad1a8-2aa3-7650-83d1-8520d65ed6af")
9495
```
9596

docs/module.html.jinja2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,9 @@
3838
</script>
3939

4040
{% endblock %}
41+
42+
{#{% block nav_footer %}#}
43+
{# <footer>My Package v{{ env["VERSION"] | default("1.0") }}</footer>#}
44+
{#{% endblock %}#}
45+
46+
{#{% block attribution %}{% endblock %}#}

0 commit comments

Comments
 (0)