A python library that allows web services to be registered to one or more cranker routers(Api gateway)
Project description
crank4y-connector
- A python library that allows you to register python web service to one or more
API GATEWAYcranker routers - it is the client endpoint of a
API GATEWAY
Dependencies:
- python >= 3.6
- numpy(optional, for better performance)
- requests
- yarl
- 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:
pip install crank4py-connector- create a web service that hosts al requests on some path prefix, e.g.
/service-a/... - start a web service on a random port
- construct a
Configobject 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,
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
crank4py_connector-0.0.5.tar.gz
(13.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crank4py_connector-0.0.5.tar.gz.
File metadata
- Download URL: crank4py_connector-0.0.5.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5695428e3b6b6fb5cb22689e0503753fa42f50323b0d2d4a85c1a71fbe422f36
|
|
| MD5 |
2b86cebf13e2b4160917582df0c49f51
|
|
| BLAKE2b-256 |
12e5d71f297f8e9602e99016ea8ca46effe2a72297748db2d1443f1bf39bb6e2
|
File details
Details for the file crank4py_connector-0.0.5-py3-none-any.whl.
File metadata
- Download URL: crank4py_connector-0.0.5-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0eb00a812ae100bbf642f4af70f19ffe9165591a97dcff3a01cd02a15dba0ee0
|
|
| MD5 |
b2329656af7f30758b89b06bf6201e24
|
|
| BLAKE2b-256 |
5c641606ca759f1369da60b9e19ab864ac84401e9869fedfa169e7bb811b9e52
|