crank4py-connector-0.0.5
توضیحات
A python library that allows web services to be registered to one or more cranker routers(Api gateway)
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | crank4py-connector-0.0.5 |
| نام | crank4py-connector |
| نسخه کتابخانه | 0.0.5 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | torchcc |
| ایمیل نویسنده | 1553765526@qq.com |
| آدرس صفحه اصلی | https://github.com/torchcc/crank4py-connector |
| آدرس اینترنتی | https://pypi.org/project/crank4py-connector/ |
| مجوز | - |
crank4y-connector
-----
1. A python library that allows you to register python web service to one or more `API GATEWAY` [cranker routers](https://github.com/torchcc/crank4go)
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
```python
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,
```
نیازمندی
| مقدار | نام |
|---|---|
| ==1.1.0 | websocket-client |
| - | requests |
| - | yarl |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl crank4py-connector-0.0.5:
pip install crank4py-connector-0.0.5.whl
نصب پکیج tar.gz crank4py-connector-0.0.5:
pip install crank4py-connector-0.0.5.tar.gz