Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Make easier to use Tuya’s API.

Project description

tuya-api

tuya-api is a lib that make you easier to use tuya's api.

Install

pip install tuya-api

Example

import logging

import tornado.ioloop
import tornado.web
from tornado import gen

from tuya_api import Tuya

ty = Tuya(client_id='your client_id', secret='your secret', schema='you schema')


class TokenHandler(tornado.web.RequestHandler):
    def data_received(self, chunk):
        pass

    @gen.coroutine
    def get(self):
        try:
            ret = yield ty.get_access_token()
            return self.write(ret)
        except Exception as e:
            logging.exception(e)


def main():
    app = tornado.web.Application([
        (r"/token", TokenHandler)
    ])
    app.listen(8888)

    print("=" * 100)
    print("* Server: Success!")
    print("* Host:   http://localhost:8888")
    print("* Quit the server with Control-C")
    print("=" * 100)
    tornado.ioloop.IOLoop.instance().start()


if __name__ == '__main__':
    main()

Document

document

Author

Feiben(feiben.dev@gmail.com)

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
tuya_api-1.0.5-py3-none-any.whl (5.9 kB) Copy SHA256 hash SHA256 Wheel py3
tuya_api-1.0.5.tar.gz (5.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page