Coder Social home page Coder Social logo

microgear-python's People

Contributors

chaiwith avatar chavee avatar phondanai avatar ridnarong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

microgear-python's Issues

Cache structure

add key to object and maintain compatability.
Handle invalid cache.
When current key is not match with key in cache send revoke token then clear credential in cache.

Implement on_rejected

on_rejected เป็น event ที่เกิดเมื่อ microgear เชื่อมต่อไม่สำเร็จ เนื่องจาก token ถูกปฏิเสธ อาจเป็นเพราะ token ถูก revoke หรือ disable

Accept scope option when client.create()

scope
เป็นการต่อกันของ string ในรูปแบบต่อไปนี้ คั่นด้วยเครื่องหมาย comma

  • [r][w]:</topic/path> - r และ w คือสิทธิ์ในการ publish ละ subscribe topic ดังที่ระบุ เช่น rw:/outdoor/temp
  • name:<gearname> - คือสิทธิ์ในการตั้งชื่อตัวเองว่า <gearname>
  • chat:<gearname> - คือสิทธ์ในการ chat กับ <gearname>
    ในขั้นตอนของการสร้าง key บนเว็บ netpie.io นักพัฒนาสามารถกำหนดสิทธิ์ขั้นพื้นฐานให้แต่ละ key ได้อยู่แล้ว หากการ create microgear อยู่ภายใต้ขอบเขตของสิทธิ์ที่มี token จะถูกจ่ายอัตโนมัติ และ microgear จะสามารถเชื่อมต่อ netpie platform ได้ทันที แต่หาก scope ที่ร้องขอนั้นมากเกินกว่าสิทธิ์ที่กำหนดไว้ นักพัฒนาจะได้รับ notification ให้พิจารณาอนุมัติ microgear ที่เข้ามาขอเชื่อมต่อ ข้อควรระวัง หาก microgear มีการกระทำการเกินกว่าสิทธิ์ที่ได้รับไป เช่น พยายามจะ publish ไปยัง topic ที่ตัวเองไม่มีสิทธิ์ netpie จะตัดการเชื่อมต่อของ microgear โดยอัตโนมัติ ในกรณีที่ใช้ APPKEY เป็น gearkey เราสามารถละเว้น attribute นี้ได้ เพราะ APPKEY จะได้สิทธิ์ทุกอย่างในฐานะของเจ้าของ app โดย default อยู่แล้ว

ตัวอย่างจาก NodeJS

var microgear = MicroGear.create({
    gearkey : "sXfqDcXHzbFXiLk",
    gearsecret : "DNonzg2ivwS8ceksykGntrfQjxbL98",
    scope : "r:/outdoor/temp,w:/outdoor/valve,name:logger,chat:plant"
});

Implement execute topic

Change prefix
from @present to &present
from @absent to &absent
Add new execute topic as following

  • Every microgear must subscribe '/&id/client_id/#' topic
    Implement read/write stream

Microgear new parameters

Add "lable" into option parameter in client.create().
Add library constant eg. "PY11g;" -> Python 1.1.7
both lable and lib version will send to NETPIE via verifier

Implement resettoken

ล้าง token ออกจาก cache ส่งผลให้ microgear ต้องขอ token ใหม่

Check compatibility with Python 3

ลองดูว่ารันบน Python 3 ได้หรือเปล่า เพราะ dependency ที่ใช้ อาจจะยังไม่สนับสนุน

Implement on_error

เป็น event ที่เกิดมี error ขึ้นภายใน microgear

Handle conection return code

4: Invalid token -- Reset stored access token
5: Unauthorized or disabled key -- Try to reconnect with existing access token

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.