flask_httpclient帮助文档
简介
对 requests 库进行包装,需要在 Flask 配置文件或对象创建时配置以下参数:
- 请求URL: {config_prefix}_URL/base_url
- 请求超时:{config_prefix}_TIMEOUT/timeout
- 实例前缀:config_prefix
- 重试次数:retry
安装
pip install flask-httpclient
使用
from flask_httpclient import HTTPClient
http_client = HTTPClient(base_url='xxx',timeout=1, config_prefix='OPEN_API')
# 创建 Flask 应用时集成扩展
def create_app():
app = Flask(__name__)
http_client.init_app(app)
# app 中使用
resp = http_client.get('/users', params=params)
License
Metadata
Release files for Flask-HTTPClient 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Flask-HTTPClient-1.0.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Flask_HTTPClient-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / Flask-HTTPClient-1.0.tar.gz
| Download URL | Flask-HTTPClient-1.0.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e9c335333b7cc8c268b582686aed4c9325881de61a229ddd5097d1f1cae2539e
|
|
BLAKE2b-256 checksum How to use checksums |
2e1cd8bfbb0f6834f3183c2398d2c4acb3951c7ca8c0934a599ade3c457394b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.0
|
Release files / Flask_HTTPClient-1.0-py3-none-any.whl
| Download URL | Flask_HTTPClient-1.0-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95a44ca708be276a14832651d83e4e2f1ef1fb1abed86d083250dca9c678509a
|
|
BLAKE2b-256 checksum How to use checksums |
fc96d8623a1302d3a23e9db3016a24afab3fe9ab9297d52a344a1f67bc9533fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.0
|