From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 52D981581D3 for ; Tue, 28 May 2024 03:48:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 83A5BE2A43; Tue, 28 May 2024 03:48:08 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 22302E2A43 for ; Tue, 28 May 2024 03:48:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 368B833DF47 for ; Tue, 28 May 2024 03:48:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 61BD117 for ; Tue, 28 May 2024 03:48:05 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1716868080.55402ec0df846a42dba44c295b5761a770724ce8.sam@gentoo> Subject: [gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/ X-VCS-Repository: proj/mirrorselect X-VCS-Files: mirrorselect/extractor.py X-VCS-Directories: mirrorselect/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 55402ec0df846a42dba44c295b5761a770724ce8 X-VCS-Branch: master Date: Tue, 28 May 2024 03:48:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b46da8c8-3770-4e64-b2e7-ef29f5673121 X-Archives-Hash: 39dac63c1b41974aa50b1d0aaa8a10c3 commit: 55402ec0df846a42dba44c295b5761a770724ce8 Author: Michał Górny gentoo org> AuthorDate: Mon May 27 18:47:13 2024 +0000 Commit: Sam James gentoo org> CommitDate: Tue May 28 03:48:00 2024 +0000 URL: https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=55402ec0 extractor.py: Replace sslfetch with plain requests sslfetch was a thin NIH wrapper around requests, and it is unmaintained. Closes: https://bugs.gentoo.org/932145 Signed-off-by: Michał Górny gentoo.org> Closes: https://github.com/gentoo/mirrorselect/pull/1 Signed-off-by: Sam James gentoo.org> mirrorselect/extractor.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/mirrorselect/extractor.py b/mirrorselect/extractor.py index 4598b8b..7326c86 100644 --- a/mirrorselect/extractor.py +++ b/mirrorselect/extractor.py @@ -27,8 +27,9 @@ Distributed under the terms of the GNU General Public License v2 import os +import requests + from mirrorselect.mirrorparser3 import MirrorParser3 -from sslfetch.connections import Connector from mirrorselect.version import version USERAGENT = "Mirrorselect-" + version @@ -103,21 +104,14 @@ class Extractor: self.output.print_info("Downloading a list of mirrors...\n") - # setup the ssl-fetch ouptut map - connector_output = { - "info": self.output.write, - "debug": self.output.write, - "error": self.output.print_err, - "kwargs-info": {"level": 2}, - "kwargs-debug": {"level": 2}, - "kwargs-error": {"level": 0}, - } - - fetcher = Connector(connector_output, self.proxies, USERAGENT) - success, mirrorlist, timestamp = fetcher.fetch_content(url, climit=60) - parser.parse(mirrorlist) - - if (not mirrorlist) or len(parser.tuples()) == 0: + response = requests.get(url, + timeout=60, + proxies=self.proxies, + headers={"User-Agent": USERAGENT}) + if response: + parser.parse(response.text) + + if len(parser.tuples()) == 0: self.output.print_err( "Could not get mirror list. " "Check your internet connection." )