From: Oleg Broytman Date: Thu, 6 Mar 2025 17:09:58 +0000 (+0300) Subject: Feat(Robots/bkmk_rhttpx): Use `httpx.Client()` X-Git-Tag: 6.4.0~4 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=7e994d765c3193ed4daadbccd008d4819373d9b5;p=bookmarks_db.git Feat(Robots/bkmk_rhttpx): Use `httpx.Client()` --- diff --git a/Robots/bkmk_rhttpx.py b/Robots/bkmk_rhttpx.py index b1451c6..977342d 100644 --- a/Robots/bkmk_rhttpx.py +++ b/Robots/bkmk_rhttpx.py @@ -35,12 +35,11 @@ class robot_httpx(robot_base): else: proxy = None - error = r = None try: - r = httpx.get(url, headers=req_headers, + with httpx.Client(proxy=proxy, verify=False) as c: + r = c.get(url, headers=req_headers, timeout=httpx.Timeout(self.timeout), - follow_redirects=False, proxy=proxy, - verify=False) + follow_redirects=False) except (httpx.RequestError, socksio.ProtocolError) as e: error = str(e) return error, None, None, None