Git Product home page Git Product logo

pyflaskresthooks's Introduction

PyFlaskResthooks

Simple demo of Python+Flask code for REST-Hooks. The primary objective was for me to get my head around how REST-Hooks work and what (minimal) state was needed to track the subscriptions, etc. at the server level.

  • www directory contains the code needed for start-up (assumes apache/wsgi)
  • www/flask_app contains the main code
  • testing contains some simple python-requests scripts
  • thunkable contains an AIA file suitable for Thunkable or MIT-AppInventor

With an external subscription service (e.g. Zapier), the service would:

  • Reach out to the "subscribe" end-point (POST to /), with a user's credentials
    • Following Zapier, the server looks for an 'event' and 'target_url'
  • The server stores that subscription info
  • When the 'event' happens (data is received), the server would make the calls to the target_url's
    • The assumption is that a device would POST data to /data/event and that would initiate the callback to the target_url's

The Thunkable/MIT-AI app models a simple IOT-style interaction:

  • The device generates a random device-code and registers it with the server
    • The device then presents that code to the user and instructs the user to "activate" it
  • The user logs in to some web-UI (not provided, but the hooks are built-in) and activates the device-code
  • The device eventually polls the server to see if the code has been "claimed"
  • If claimed by a user, the server responds to the device with a device-token (API-key) and stores the device-to-user connection in a database

Requirements:

pyflaskresthooks's People

Contributors

dependabot[bot] avatar

Watchers

James Cloos avatar

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.