check_compatibility() — requests Function Reference
Architecture documentation for the check_compatibility() function in __init__.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD ea0ebcc2_352e_eb51_9186_9a9b0ecaa25c["check_compatibility()"] 961d4893_d7e8_96e8_b607_9aeb34411448["__init__.py"] ea0ebcc2_352e_eb51_9186_9a9b0ecaa25c -->|defined in| 961d4893_d7e8_96e8_b607_9aeb34411448 style ea0ebcc2_352e_eb51_9186_9a9b0ecaa25c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/__init__.py lines 58–90
def check_compatibility(urllib3_version, chardet_version, charset_normalizer_version):
urllib3_version = urllib3_version.split(".")
assert urllib3_version != ["dev"] # Verify urllib3 isn't installed from git.
# Sometimes, urllib3 only reports its version as 16.1.
if len(urllib3_version) == 2:
urllib3_version.append("0")
# Check urllib3 for compatibility.
major, minor, patch = urllib3_version # noqa: F811
major, minor, patch = int(major), int(minor), int(patch)
# urllib3 >= 1.21.1
assert major >= 1
if major == 1:
assert minor >= 21
# Check charset_normalizer for compatibility.
if chardet_version:
major, minor, patch = chardet_version.split(".")[:3]
major, minor, patch = int(major), int(minor), int(patch)
# chardet_version >= 3.0.2, < 6.0.0
assert (3, 0, 2) <= (major, minor, patch) < (6, 0, 0)
elif charset_normalizer_version:
major, minor, patch = charset_normalizer_version.split(".")[:3]
major, minor, patch = int(major), int(minor), int(patch)
# charset_normalizer >= 2.0.0 < 4.0.0
assert (2, 0, 0) <= (major, minor, patch) < (4, 0, 0)
else:
warnings.warn(
"Unable to find acceptable character detection dependency "
"(chardet or charset_normalizer).",
RequestsDependencyWarning,
)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does check_compatibility() do?
check_compatibility() is a function in the requests codebase, defined in src/requests/__init__.py.
Where is check_compatibility() defined?
check_compatibility() is defined in src/requests/__init__.py at line 58.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free