Seamlessly depend on requests or niquests depending on what the user has installed
Project description
Anyquests
Anyquests is a transparent wrapper around either requests or niquests which doesn't install either automatically.
Motivation
Niquests is a fork of requests made to address important flaws and support modern web features. However, to do this niquests depends on urllib3.future, which takes a dramatic approach to backwards compatibility by shadowing the original urllib3 if it is present. While this can be disabled during installation, a package including urllib3.future as a dependency (even transitive) cannot control this behavior. The potential of silently breaking users' installations can discourage them from depending on niquests. This package is meant to address this issue.
Rather than depending on one or the other, package authors can depend on anyquests and let the end user decide which library to install. Anyquests will pick whichever is available, prioritizing niquests.
I am an end user, which one to choose?
If you don't have any personal preference yet, choose niquests. niquests is
a fork of requests which supports newer features such as HTTP/3 over QUIC.
Be aware, however, that by default installing niquests will shadow urllib3
with a different, improved implementation.
If this is a concern for you, see https://niquests.readthedocs.io/en/latest/community/faq.html#cohabitation
for instructions on how to disable that. See also https://niquests.readthedocs.io/en/latest/community/faq.html#what-is-urllib3-future
for an explanation of why niquests does that.
Usage
Add anyquests to the dependencies in your pyproject.toml. Then just import
the library with:
import anyquests
# or
import anyquests as requests
The imported library will be the same as the result of either import niquests
or import requests. If none are availabe, an ImportError will be raised
with a helpful message instructing the user to install one or the other.
If you want to guarantee that your package will run out of the box even if the
user doesn't have either requests or niquests installed, you can also
add an explicit dependency on requests. anyquests will still opportunistically
switch to niquests when available.
Note that this package does not impose any restrictions on the versions of
either requests or niquests.
License
To match the licenses of the original requests and niquests, this package is licensed under the Apache License, Version 2.0.
© 2026 abel1502
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anyquests-1.0.0.tar.gz.
File metadata
- Download URL: anyquests-1.0.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6ad049ebfcfa6f8e3f23bc48d99b777e50f7f3110e1264b448fbca3fa095b0e
|
|
| MD5 |
a7d70ee9a6152d0f5f23eff8b2ebe922
|
|
| BLAKE2b-256 |
fdaab3e179bcdb68f1edbac553944d180d2c9cf8d582b0440b09b252300488fb
|
File details
Details for the file anyquests-1.0.0-py3-none-any.whl.
File metadata
- Download URL: anyquests-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00a3af78b749382769acf3d338420ba1147a321e6af2a0c6297665b558f81f4b
|
|
| MD5 |
3a6838223d77de04894ce68b0727e449
|
|
| BLAKE2b-256 |
0256a60fb283114338fdc06e4793f45614bc73936e34805487caddc339343e6d
|