Skip to content

Commit

Permalink
Merge pull request #6562 from amkarn258/issue-6223
Browse files Browse the repository at this point in the history
every chardet package maps to requests.packages.chardet.* package respectively
  • Loading branch information
sigmavirus24 authored Feb 23, 2024
2 parents f3f2611 + 89cde23 commit eea3bbf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/requests/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
target = chardet.__name__
for mod in list(sys.modules):
if mod == target or mod.startswith(f"{target}."):
target = target.replace(target, "chardet")
sys.modules[f"requests.packages.{target}"] = sys.modules[mod]
imported_mod = sys.modules[mod]
sys.modules[f"requests.packages.{mod}"] = imported_mod
mod = mod.replace(target, "chardet")
sys.modules[f"requests.packages.{mod}"] = imported_mod
# Kinda cool, though, right?

0 comments on commit eea3bbf

Please sign in to comment.