reqe
A python network request library that will not throw exceptions
Table of Contents
Background
When timeout, network connection error, server error, etc.,
requests will raise the exception, there will be a lot of try ... except ... in the code.
Under the above problems, I developed a reqe based on the requests library, which is as simple as requests
Install
git clone git@github.com:ophlr/reqe.git
pip install reqe
Usage
import reqe
# use default setting, it can be used like request
response = reqe.get("https://www.baidu.com")
if response:
print(response)
# specify the params that you like
# retries: How many retries, If you don’t want to resend the request, you can set retries to 0
# delay: time between two requests
# backoff: delay = delay * backoff
response = reqe.get("https://www.google.com", retries=3, delay=3, backoff=2)
# when `requests` raises an exception, `reqe` will catch it and let the response be None
if response:
print(response)
# how to use reqe with session
session = reqe.session()
response = session.get("https://www.google.com", retries=1, delay=3, backoff=2)
print(response)
Reference
License
Metadata
Release files for reqe 2020.9.17.175617
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reqe-2020.9.17.175617-py3-none-any.whl | Python 3 | none | any | Details for reqe-2020.9.17.175617-py3-none-any.whl |
Release files / reqe-2020.9.17.175617-py3-none-any.whl
| Download URL | reqe-2020.9.17.175617-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce9bd58707f4369d4dbf1de9a93cee841095d91a2294dc5bcbf00a84cbcd9fa2
|
|
BLAKE2b-256 checksum How to use checksums |
3d01acd1e7014b1febf4e598bdf2de95ce5620e829bcbae72ec8b6f90ef82240
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3
|
Security for reqe 2020.9.17.175617
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.