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 Config, Domain
config = Config(('MY_API_KEY account=MY_ACCOUNT', ''))
Domain.list(name='paul', config=config)[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.
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
Hashes for alwaysdata_api-0.9.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8209dce6cad3a74a63e63edce7d234a747acc14ab0c07704971e5386d25479e0 |
|
MD5 | b2d5bf1df2ee1d071f27e868e58dd855 |
|
BLAKE2b-256 | b3ca042a307e1046cf5ce17c2373b893acdb8cf93de6a3e4f4549a038a7409c2 |