lastapi
The Omni REST API Client
This is still WIP, but I've got prototype working which is for the update DNS function using CloudFlare API.
The project is written in Python 3. You can install dependencies with
pip3 install --user -r requirements.txt
Walk-through
REST API schema
The schema is defined in schemas/cloudflare.yaml
---
Name: cloudflare
Base:
Protocol: https
Host: api.cloudflare.com
Headers:
X-Auth-Key: ${auth_key}
X-Auth-Email: ${auth_email}
Content-Type: application/json
Actions:
update_dns:
Path:
- /client/v4/zones/
- ${zone_id}
- /dns_records/
- ${dns_id}
Method: PUT
Payload:
type: ${dns_type}
name: ${dns_name}
content: ${dns_content}
ttl: 1
proxied: true
This will be verified against schemas/schema.yaml using pykwalify.
Global parameters
Global parameters for the API, usually API key and account stuff, are in schemas/cloudflare-params.yaml.example. You should duplicate it and remove the .example suffix and put in real credential.
---
auth_key: sample-api-key
auth_email: raynix@some.email
Invoking an Action in the schema
To invoke the update_dns action defined in the schema, run:
./lapi --schema schemas/cloudflare --func update_dns --vars zone_id=xxx,dns_id=xxx,dns_type=A,dns_name=mydomain.com,dns_content=1.2.3.4
Please comment or raise an issue if this doesn't work for you.
Metadata
Release files for lastapi 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lastapi-0.2.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lastapi-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 kB
Release files / lastapi-0.2.tar.gz
| Download URL | lastapi-0.2.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bac0383c30045e816649677033990ed6867b8ae439394d4057156b3a5e743957
|
|
BLAKE2b-256 checksum How to use checksums |
ae3ce9b2dff17d3e2ff3e1526ef6e80e22a4139d785797e6991636c42ea18518
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / lastapi-0.2-py3-none-any.whl
| Download URL | lastapi-0.2-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75056dc3241de7bae42117d6732bbd93315e3bda4978dc974bfc93fad4ca4a6c
|
|
BLAKE2b-256 checksum How to use checksums |
db05ebb495423706bd6b94cb7538dce0f7857fef16246915807ccf733371b30a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|