Skip to main content

HTTP client extension for Flask.

对requests库的包装,在flask配置文件中配置base_url, auth, 转发user-agent等。第一次访问网址生成全局的session, 本次request结束后, 关闭此session。

安装

pip install flask-http-client

使用

First init:

from flask_http_client import HTTPClient
http_client = HTTPClient()
http_client.init_app(app)

API

和requests的API一致,需要注意的是 url = base_url + path,所以base_url和path需要自己做好处理。

params = {}
resp = http_client.request('GET', '/users/', params=params)
resp = http_client.get('/users', params=params)

配置项

可以在构造方法修改配置前缀,默认为 HTTP_CLIENT

http_client = HttpClient(config_prefix='YOUR_CONFIG_PREFIX')

配置项

说明

HTTP_CLIENT_BASE_URL

api的url_prefix

HTTP_CLIENT_AUTH

requests中的auth参数

Metadata

Release files for flask-http-client 0.1.6

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

Source distribution (sdist)

Source distribution for flask-http-client 0.1.6
File Size Uploaded Provenance Actions
flask_http_client-0.1.6.tar.gz 3.1 kB Without provenance Details for flask_http_client-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flask-http-client 0.1.6
File Interpreter ABI Platform Actions
flask_http_client-0.1.6-py3-none-any.whl Python 3 none any Details for flask_http_client-0.1.6-py3-none-any.whl

Total release size: 6.6 kB

Release files / flask_http_client-0.1.6.tar.gz

Download URL flask_http_client-0.1.6.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
962429d5d40730ea89dd98a1272bcc74b5e804fcb751b78358602a34aab15bbc
BLAKE2b-256 checksum
How to use checksums
1771921ecb5c84c12809ed7a71013cd678b12b6431f0bad28aeb07fd5e09c60b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Darwin/21.6.0

Release files / flask_http_client-0.1.6-py3-none-any.whl

Download URL flask_http_client-0.1.6-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
882b02d07a486890ba892f1a74942405f7de2a85c9b1dad9613eb42cef411f62
BLAKE2b-256 checksum
How to use checksums
e528263ec5958519268cbe6ab62b78d1ac609f83b8400eba94cc82a580b426d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Darwin/21.6.0

Security for flask-http-client 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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