Skip to main content

Aidbox client for python

Project description

|Build Status| |codecov| |pypi|

aidbox-py
=========

Aidbox client for python. This package provides an API for CRUD
operations over aidbox resources

API
===

To obtain token by email and password use static method:
``Aidbox.obtain_token(host, email, password)``

To create Aidbox instance use:

``Aidbox(host, token)``

Returns an instance of the connection to the aidbox server which
provides: \* .reference(resource_type, id, **kwargs) - returns
``AidboxReference`` to the resource \* .resource(resource_type,
**\ kwargs) - returns ``AidboxResource`` which described below \*
.resources(resource_type) - returns ``AidboxSearchSet``

``AidboxResource``

provides: \* .save() - creates or updates resource instance \* .delete()
- deletes resource instance \* .to_reference(**kwargs) - returns
``AidboxReference`` for this resource \* setattr/getattr using dot
operator

``AidboxReference``

provides: \* .to_resource() - returns ``AidboxResource`` for this
reference

``AidboxSearchSet``

provides: \* .search(param=value) \* .limit(count) \* .page(page) \*
.sort(\ *args) * .execute() - makes query to the server and returns a
list of ``AidboxResource`` \* .first() - returns ``AidboxResource`` or
None \* .get(id=id) - returns ``AidboxResource`` or raises
``AidboxResourceNotFound``

Usage
=====

Create an instance

.. code:: python

ab = Aidbox(host='host', token='token')

Fetch list of resource’s instances

.. code:: python

resources = ab.resources('Patient') # Return lazy search set
resources = resources.search(name='John').limit(10).page(2).sort('-id', 'name')

resources.execute() # Returns list of AidboxResource

Get the particular instance of resource

.. code:: python

res = ab.resources('Entity').get(id=1)

Create new resource’s instance

.. code:: python

res = ab.resource('Entity')
res.name = 'Chat'
res.save() # Creates new instance

res.name = 'Chat2'
res.save() # Updates the instance

res.delete() # Deletes the instance

.. |Build Status| image:: https://travis-ci.org/beda-software/aidbox-py.svg?branch=master
:target: https://travis-ci.org/beda-software/aidbox-py
.. |codecov| image:: https://codecov.io/gh/beda-software/aidbox-py/branch/master/graph/badge.svg
:target: https://codecov.io/gh/beda-software/aidbox-py
.. |pypi| image:: https://img.shields.io/pypi/v/aidbox.svg
:target: https://pypi.python.org/pypi/aidbox

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

aidbox-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

File details

Details for the file aidbox-0.1.0.tar.gz.

File metadata

  • Download URL: aidbox-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aidbox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 04d60c4985b95b1cb9726a903a5642ef2c7c7ae8d594e6e6e4977c097dcfae2a
MD5 88c517f68a8699dece118f7caf422d97
BLAKE2b-256 4a4a67ec956c537fa62d1343c587b5d46d544a9f0e994665e5bdb88ed9f6cb07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page