Skip to main content

aligi

Aliyun Gateway Interface

为无服务函数计算作为阿里云 API 后端运行提供转析,并且允许同一个无服务函数既支持 HTTP 触发器,也支持作为 API 网关的后端服务。

为什么会有这个库?

使用 Flask,Django 等支持标准 WSGI 协议的 Web 框架创建无服务函数时,使用HTTP触发器才能让它们正常运行。

但如果想使用无服务函数作为阿里云 API 网关的后端时,则无法直接使用这些函数,只能通过网络调用,这显然是不够高效、并且费钱的。

如何安装

在项目根目录下执行

pip install -t . aligi

如何使用

以下为一个最小的 Flask 样例

from flask import Flask
from aligi import WSGI

app = Flask(__name__)


@app.route("/")
def hello_world():
    return "Hello, World!"


# 阿里云无服务函数的入口
handler = WSGI(app)

其中app可以是任意一个标准 WSGI Application。

在 Django 项目中,它一般在项目的wsgi.py里。

参考文档

阿里云文档:

Release files for aligi 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aligi 1.1.0
File Size Uploaded
aligi-1.1.0.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aligi 1.1.0
File Interpreter ABI Platform
aligi-1.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size:10.1 kB

Release files / aligi-1.1.0.tar.gz

Download URL aligi-1.1.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
48ea0fc33f836f576ac9e79702e660c43a959df0eefd5802a8c04b258c26a1f7
BLAKE2b-256 checksum
How to use checksums
09033855a2a24327b4b4d84fd8f3581f22ae5907bee3c269d833752c19ac113e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.48.0 CPython/3.7.4

Release files / aligi-1.1.0-py2.py3-none-any.whl

Download URL aligi-1.1.0-py2.py3-none-any.whl
Size 5.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
507a1436b112a9772d51c4efe140ddc71e94f597dd4e917d39d5af0090f6186a
BLAKE2b-256 checksum
How to use checksums
0278559f6ca91d9b40b80b273b9c3090654cf4d2bb5efcc8304e256ec4a67c24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.48.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page