A dead simple Python interface to the Alwaysdata API.
Project description
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 fromres1
tores2
to 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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file alwaysdata_api-0.9.4.tar.gz
.
File metadata
- Download URL: alwaysdata_api-0.9.4.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a35f840aff1c3d8c18347ecf8830acaad16db7d5b6c6f2e415838aefb7f0c54 |
|
MD5 | ae7043873e370bcd29385df9a5843e1e |
|
BLAKE2b-256 | c5fcd456de167badff1e31e2b5cf01026e0e9117fd2ac1ebde712c05d95a59ef |
File details
Details for the file alwaysdata_api-0.9.4-py3-none-any.whl
.
File metadata
- Download URL: alwaysdata_api-0.9.4-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a01533e6ba357303515dcf3f97f9ad14d01556e217865a5f7148f0eb1f67ae8 |
|
MD5 | 5a6d3d767241f5813e86e765cb090742 |
|
BLAKE2b-256 | d14e753c8e085441594f2923cd6444d5154f4feca4c3ebd1fe6f6a026a018b20 |