Giter Club home page Giter Club logo

crank4py-connector's Introduction

crank4y-connector

  1. A python library that allows you to register python web service to one or more API GATEWAY cranker routers
  2. it is the client endpoint of a API GATEWAY

Dependencies:

  1. python >= 3.6
  2. numpy(optional, for better performance)
  3. requests
  4. yarl
  5. websocket-client == 0.57.0 (pls use this version, do not try higher version, trust me, there are bugs in higher versions)

Usage

  • There are mainly 4 steps:

    1. pip install crank4py-connector
    2. create a web service that hosts al requests on some path prefix, e.g. /service-a/...
    3. start a web service on a random port
    4. construct a Config object and start a connector
  • example

from flask import Flask
from crank4py_connector import Config
from crank4py_connector import create_and_start_connector

router_uris = ["wss://localhost:9070", "wss://localhost:9070"]
my_service_uri = "http://localhost:5000"  
config = Config(my_service_uri, "service-a", router_uris, component_name="service-a-component")
connector = create_and_start_connector(config)

app = Flask(__name__, static_url_path="")
@app.route("/service-a/hello")
def hello():
    return "hello"
app.run(host="localhost", port=5000)

# or you can refer to crank4py_connector
# and then you can query your api gateway to access your server-a. e.g. if your router listens on https://localhost:9000, then you can access  https://localhost:9000/service-a/hello,

crank4py-connector's People

Contributors

torchcc avatar

Stargazers

Troy 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.