跳转到主要内容

部署函数变得简单

项目描述


Firefly
-------

Firefly是一个将Python函数暴露为RESTful API的工具。

安装
~~~~~~~

可以使用pip进行安装。

..code:: bash

$ pip install firefly-python

使用方法
~~~~~

编写一个Python函数

..code:: python

# sq.py
def square(n)
return n*n

然后使用firefly运行它

..code:: bash

$ firefly sq.square
[2017-06-08 12:45:11 +0530] [20237] [INFO] Starting gunicorn 19.7.1
[2017-06-08 12:45:11 +0530] [20237] [INFO] Listening at: http://127.0.0.1:8000 (20237)
...

Firefly提供了一个简单的客户端接口与服务器交互。

..code:: python

>>> from firefly.client import Client
>>> client = Client("http://127.0.0.1:8000")
>>> client.square(n=4)
16

或者,您可以直接使用API

..code:: bash

$ curl -d '{"n": 4}' http://127.0.0.1:8000/square
16

链接
~~~~~

* `文档 <https://firefly-python.readthedocs.io/>`_
* `Github <https://github.com/rorodata/firefly>`_

项目详情


下载文件

下载适合您平台的文件。如果您不确定要选择哪个,请了解有关安装软件包的更多信息。

源代码分发

firefly-python-0.1.15.tar.gz (9.3 kB 查看哈希值)

上传时间 源代码

构建发行版

firefly_python-0.1.15-py3-none-any.whl (12.5 kB 查看哈希值)

上传时间 Python 3