tinysou

Tinysou Python Client


License
MIT
Install
pip install tinysou==0.0.1

Documentation

tinysou-python

Build Status

Tinysou Python Client

Installation

$ pip install tinysou

Usage

import tinysou
client = tinysou.Client('YOUR_TOKEN')

Engine

List:

client.engines.list()

Create:

client.engines.create({'name': 'blog', 'display_name': 'Blog'})

Retrieve:

client.engines.get('blog')

Update:

client.engines.update('blog', {'display_name': 'My Blog'})

Delete:

client.engines.delete('blog')

Collection

List:

client.collections.list('blog')

Create:

client.collections.create('blog',
                          {'name': 'posts',
                           'field_types': {
                                'title': 'string',
                                'tags': 'string',
                                'author': 'enum',
                                'date': 'date',
                                'body': 'text'
                           }})

Retrieve:

client.collections.get('blog', 'posts')

Delete:

client.collections.delete('blog', 'posts')

Document

List:

client.documents.list('blog', 'posts', {'page': 0, 'per_page': 20})

Create:

client.documents.create('blog', 'posts', {
    'title': 'My First Post',
    'tags': ['news'],
    'author': 'Author',
    'date': '2014-08-16T00:00:00Z',
    'body': 'Tinysou start online today!'
})

Retrieve:

client.documents.get('blog', 'posts', '293ddf9205df9b36ba5761d61ca59a29')

Update:

client.documents.update('blog', 'posts', '293ddf9205df9b36ba5761d61ca59a29', {
    'title': 'First Post',
    'tags': ['news'],
    'author': 'Author',
    'date': '2014-08-16T00:00:00Z',
    'body': 'Tinysou start online today!'
})

Delete:

client.documents.delete('blog', 'posts', '293ddf9205df9b36ba5761d61ca59a29')

Search

client.search('blog', {
    'q': 'tinysou', 'c': 'posts',
    'page': 0, 'per_parge': 10,
    'filter': {
        'range': {
            'field': "date",
            'from': "2014-07-01T00:00:00Z",
            'to': "2014-08-01T00:00:00Z"
        }
    },
    'sort': {
        'field': "date",
        'order': "asc",
        'mode': "avg"
    }
})

Autocomplete

client.autocomplete('blog', {'q': 't', 'c': 'posts'})

Examples

See examples

Contributing

  1. Fork it ( https://github.com/tinysou/tinysou-python/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request