semvec/pypi-packages huggingface dataset:
preferred-pictures 0.5
A client for the PreferredPictures API
License: MIT
Keywords: preferred.pictures,optimization

# PreferredPictures Python Client Library

The [PreferredPictures](https://preferred.pictures) Python library provides a convenient way to call the
[PreferredPictures](https://preferred.pictures) API for applications written in Python.

[View the documentation of this module](https://preferred-pictures.github.io/python/build/html/index.html)

[View the documentation about the PreferredPicture's API](https://docs.preferred.pictures/api-sdks/api)

[Learn more about what PreferredPictures can do.](https://docs.preferred.pictures/)

## Installation

```
$ pip install preferred_pictures
```

## Usage

The package needs to be configured with your account's identity and
secret key, which is available in the PreferredPictures interface.

```python

from preferred_pictures import Client

pp = Client("testidentity", "secret123456")
url = pp.create_choose_url(
    choices=[
        "https://example.com/image-red.jpg",
        "https://example.com/image-green.jpg",
        "https://example.com/image-blue.jpg"
    ],
    tournament="test-tournament")

# Or more using a prefix and suffix for choices

url = pp.create_choose_url(
    choices=["red", "green", "blue"],
    choices_prefix="https://example.com/image-",
    choices_suffix=".jpg",
    tournament="test-tournament")


# The URL returned will appear to be something like:
#
# https://api.preferred-pictures.com/choose-url?choices%5B%5D=red&choices%5B%5D=green&choices%5B%5D=blue&tournament=test-tournament&expiration=1597011644&uid=362511d6-997f-452b-afee-8e46331da04a&ttl=600&identity=testidentity&signature=7c6d305405b4518876543435ce5657ee820cad0601359fa173a854dc0dfd6ea1
#
```

## License

This client uses the MIT license.
aligi 1.1.0
为阿里无服务函数提供API网关的协议解析
License: MIT
Requires Python: >=3.6.0
Keywords: aliyun,api,serverless,python

# aligi

Aliyun Gateway Interface

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

## 为什么会有这个库？

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

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

## 如何安装

在项目根目录下执行

```
pip install -t . aligi
```

## 如何使用

以下为一个最小的 Flask 样例

```python
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`里。

## 参考文档

阿里云文档:

- [HTTP 触发器](https://help.aliyun.com/document_detail/74756.html?spm=a2c4g.11186623.2.29.4a4b6482rl6rYZ#h2--http-2)

- [API 网关触发器](https://help.aliyun.com/document_detail/74800.html?spm=a2c4g.11186623.6.696.24bd2ebcuaTlC2)