Coder Social home page Coder Social logo

tago-sdk-python's Introduction

Tago - Python Lib

Official Python lib for Tago

Code Status

wercker status

Documentation

Installation

$ sudo pip install -U tago

Usage

Insert Data

.insert(OBJECT)

from tago import Tago

MY_DEVICE_TOKEN = 'add your device token here'
my_device = Tago(MY_DEVICE_TOKEN).device

data_to_insert = {
    'variable' : 'temperature',
    'location' : {'lat': 42.2974279, 'lng': -85.628292},
    'time'     : '2014-01-20 03:43:59',
    'unit'     : 'C',
    'value'    : 63
}

my_device.insert(data_to_insert) # Without response
# or
result = my_device.insert(data_to_insert) # With response
if result['status']:
    print 'Data added'
else:
    print result['message']
Find Data

.find(OBJECT)

result = my_device.find({'query': 'last_value'})
if result['status']:
    print result['message'] # Array with data
else:
    print result['message'] # Error (if status is False)
Delete Data

.delete(/ID/)

my_device.delete('Data_ID') # Without response
# or
result = my_device.delete('Data_ID') # With response
if result['status']:
    print 'Data Removed'
else:
    print result['message']
Listening new data by Socket

.listening(CALLBACK)

When new data arrives into Tago.io for you, it will be sent it to your device if you configure for this in the ‘Action’ (Left Menu in Admin). For this purpose, you need to create a new action and select the option ‘Send to Device’. All devices using the token associated with the bucket will receive the data.

def func_callback_data(data):
    print data

my_device.listening(func_callback_data)

License

Tago SDK for Python is released under the Apache-2.0 License.

tago-sdk-python's People

Contributors

kkushagra avatar vchawla3 avatar felipefdl avatar zach-delong avatar chbrown13 avatar vitorfdl avatar sunilthetab avatar suniltheta avatar

Watchers

 avatar  avatar  avatar

Forkers

chbrown13

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.