damas-core

damas-core API
Fork me on GitHub

Python API

Install

  1. Install the requests module:

with pip:

pipenv install requests

or with Debian:

apt install python-requests
  1. Get the damas-core client module for Python

Start

In a Python console:

# load the module
>>> import damas_client

# connect to the server
>>> project = damas.http_connection("https://serveripaddr")

# list every node identifiers
>>> project.search("*")

# read every nodes
>>> project.read(project.search("*"))

# create an empty element
>>> project.create({})

# create a new element wearing keys
>>> project.create({"key1":"value1","key2":"value2"})
{u'key2': u'value2', u'key1': u'value1', u'time': 1437469470133, u'_id': u'55ae0b1ed81e88357d77d0e9', u'author': u'xxx.xxx.xxx.xxx'}

# search for this element using the key it is wearing
>>> project.search("key1:value1")
[u'55ae0b1ed81e88357d77d0e9']

# read the node index
>>> project.read('55ae0b1ed81e88357d77d0e9')
[{u'key2': u'value2', u'key1': u'value1', u'time': 1437469470133, u'_id': u'55ae0b1ed81e88357d77d0e9', u'author': u'xxx.xxx.xxx.xxx'}]

Visit the API-Reference for the documentation.

Additional Python ressources

damas_socket.py is a module to connect to a damas-core server using Socketio websockets. See Event-API.