A Python client for Rancher APIs
## Installing
pip install gdapi-python
## Running as command line client
```bash
export GDAPI_URL=http://localhost:8080/v1
gdapi --help
# curl -s http://localhost:8080/v1/widgets?foo=bar
gdapi list-widget --foo=bar
# curl -s -X POST http://localhost:8080/v1/widgets -H 'Content-Type: application/json' -d '{ "foo" : "bar" }'
gdapi create-widget --foo=bar
# curl -s -X PUT http://localhost:8080/v1/widgets/42 -H 'Content-Type: application/json' -d '{ "foo" : "bar" }'
gdapi update-widget --id=42 --foo=bar
# curl -s -X DELETE http://localhost:8080/v1/widgets/42
gdapi delete-widget --id=42
```
### Environment variables
|Name | Description | Example |
|-----------------|----------------|-----------------------------------------|
|GDAPI_URL | URL of the API | http://localhost:8080/v1 |
|GDAPI_ACCESS_KEY | Access Key | 4C27AB31828A4E469C09 |
|GDAPI_SECRET_KEY | Secrey Key | fDxEzyxdFMWbmugstPpzykj2qA84Tn9DPDiAc3Sb|
The above environment variables can be passed as arguments on the command line such as `--url`, `--access-key`, and `--secret-key`.
### Bash Autocompletion
Add the below to your `.bashrc` or similar profile script:
```
eval "$(register-python-argcomplete gdapi)"
```
## Using API
```python
import gdapi
client = gdapi.Client(url='http://localhost:8080/v1',
access_key='4C27AB31828A4E469C09',
secret_key='fDxEzyxdFMWbmugstPpzykj2qA84Tn9DPDiAc3Sb')
# curl -s http://localhost:8080/v1/widgets?foo=bar
client.list_widget(foo='bar')
# curl -s -X POST http://localhost:8080/v1/widgets -H 'Content-Type: application/json' -d '{ "foo" : "bar" }'
client.create_widget(foo='bar')
# curl -s -X PUT http://localhost:8080/v1/widgets/42 -H 'Content-Type: application/json' -d '{ "foo" : "bar" }'
widget = client.by_id_widget('42')
client.update(widget, foo='bar')
# curl -s -X DELETE http://localhost:8080/v1/widgets/42
widget = client.by_id_widget('42')
client.delete(widget)
# Links
# curl -s -X DELETE http://localhost:8080/v1/widgets/42/foobars
widget = client.by_id_widget('42')
widget.foobars()
```
# Contact
For bugs, questions, comments, corrections, suggestions, etc., open an issue in
[rancher/rancher](//github.com/rancher/rancher/issues) with a title starting with `[gdapi-python] `.
Or just [click here](//github.com/rancher/rancher/issues/new?title=%5Bgdapi-python%5D%20) to create a new issue.
Metadata
Release files for gdapi-python 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gdapi-python-0.5.3.tar.gz | 9.6 kB | Without provenance | Details for gdapi-python-0.5.3.tar.gz |
Release files / gdapi-python-0.5.3.tar.gz
| Download URL | gdapi-python-0.5.3.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a935073b8f99cc76f0384057ca1b647691010e5c97aea4f065331785d31bed5
|
|
BLAKE2b-256 checksum How to use checksums |
e28e7cda861f7ce2e7474ad2d5de0cb6bd2ed37864fba46c95f3fdf5027df46f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for gdapi-python 0.5.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.