alwaysdata_api
A dead simple Python interface to the Alwaysdata API
Installation
pip install alwaysdata_api
(Use flag --user if you can't install globally.)
Usage
If you store your API key and account name in the ALWAYSDATA_API_KEY
and ALWAYSDATA_ACCOUNT environment variables, the following example
works out of the box:
from alwaysdata_api import Domain
Domain.list(name='paul')[0].name
# 'paulkoppen.com'
Alternatively, you can provide the authentication via code. The above example then needs to be expanded to include the extra configuration:
from alwaysdata_api import Auth, Domain
auth = Auth('account_name', 'api_key')
Domain.list(name='paul', auth=auth)[0].name
# 'paulkoppen.com'
See demo.py for more examples.
Every resources in the API docs has a class in this package (such
as Domain, Record, Mailbox, etc) and all resources share the same
set of methods. To give you a quick idea:
Resource.get(id)retrieves the instance.Resource.list(**query_kwargs)finds and returns the list of resources.res.post()submits the resource instance to the server to be created.res.put()updates the instance on the server.Resource.delta(res1, res2).patch()sends the changes fromres1tores2to the server.res.delete()deletes it.
Development
Although it is a simple bit of code, surely it can be improved. Contributions are very welcome. Just send a PR (please include tests). It would be equally great to have some instructions in this repo Wiki (I would have to find out how that works though :-))
Code style follows PEP accurately and uses Google style docstrings.
For testing:
python -m unittest
Licence
Release files for alwaysdata-api 0.9.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| alwaysdata_api-0.9.4.tar.gz | 12.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alwaysdata_api-0.9.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.0 kB
Release files / alwaysdata_api-0.9.4.tar.gz
| Download URL | alwaysdata_api-0.9.4.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a35f840aff1c3d8c18347ecf8830acaad16db7d5b6c6f2e415838aefb7f0c54
|
|
BLAKE2b-256 checksum How to use checksums |
c5fcd456de167badff1e31e2b5cf01026e0e9117fd2ac1ebde712c05d95a59ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / alwaysdata_api-0.9.4-py3-none-any.whl
| Download URL | alwaysdata_api-0.9.4-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a01533e6ba357303515dcf3f97f9ad14d01556e217865a5f7148f0eb1f67ae8
|
|
BLAKE2b-256 checksum How to use checksums |
d14e753c8e085441594f2923cd6444d5154f4feca4c3ebd1fe6f6a026a018b20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |