PKG_NAME:=python-requests
PKG_VERSION:=2.34.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>, Alexandru Ardelean <ardeleanalex@gmail.com>
PKG_LICENSE:=Apache-2.0
PKG_HASH:=f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed
HOST_BUILD_DEPENDS:= \
- python-chardet/host \
+ python-charset-normalizer/host \
python-idna/host \
python-urllib3/host \
python-certifi/host
URL:=https://requests.readthedocs.io
DEPENDS:= \
+python3-light \
- +python3-chardet \
+ +python3-charset-normalizer \
+python3-idna \
+python3-urllib3 \
+python3-certifi
TooManyRedirects, Timeout, ConnectTimeout, ReadTimeout
)
-print("requests OK")
+# --- charset-normalizer backend (replaces chardet) ---
+# requests now pulls in charset-normalizer instead of chardet for content
+# charset detection. Verify both the standalone library and the path that
+# requests actually exercises (Response.apparent_encoding).
+import charset_normalizer
+from charset_normalizer import from_bytes
+
+sample = 'Bсеки човек има право на образование.'
+encoded = sample.encode('cp1251')
+
+# Standalone detection + decode round-trip.
+best = from_bytes(encoded).best()
+assert best is not None
+assert str(best) == sample
+
+# chardet-compatible detect() shim — this is the exact call requests makes.
+detected = charset_normalizer.detect(encoded)
+assert detected['encoding'] is not None
+
+# requests routes content charset detection through charset-normalizer.
+resp = requests.models.Response()
+resp._content = encoded
+enc = resp.apparent_encoding
+assert enc, "apparent_encoding should be resolved via charset-normalizer"
+resp.encoding = enc
+assert 'образование' in resp.text
+
+print("requests + charset-normalizer OK")
EOF