public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mart Raudsepp" <leio@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-bumpchecker:master commit in: modules/
Date: Fri,  3 Mar 2017 23:50:54 +0000 (UTC)	[thread overview]
Message-ID: <1488580134.a196c4873b3508e1f2bf60abdefe4887f2b872fb.leio@gentoo> (raw)

commit:     a196c4873b3508e1f2bf60abdefe4887f2b872fb
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  3 22:28:54 2017 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Fri Mar  3 22:28:54 2017 +0000
URL:        https://gitweb.gentoo.org/proj/gentoo-bumpchecker.git/commit/?id=a196c487

gnome: Use requests instead of urllib2

This should give us connection pooling, which can be important for
further planned changes.

 modules/gnome_module.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/modules/gnome_module.py b/modules/gnome_module.py
index 0edf973..7c8f613 100644
--- a/modules/gnome_module.py
+++ b/modules/gnome_module.py
@@ -2,7 +2,8 @@
 # LICENSE - GPL2
 # vim: set sts=4 sw=4 et tw=0 :
 
-import urllib2, package_module, clioptions_module
+import requests
+import package_module, clioptions_module
 
 DEBUG = False
 
@@ -23,17 +24,17 @@ class GNOME:
             gnome_release_list[1] = str(int(gnome_release_list[1]) + 1)
         self.gnome_release = ".".join(gnome_release_list[:2])
 
-        self.ftpserver = "download.gnome.org"
-        self.release_versions_file_path = 'https://download.gnome.org/teams/releng/'
+        self.http = requests.session()
+        self.url_base = "https://download.gnome.org/"
+        self.release_versions_file_path = self.url_base + 'teams/releng/'
 
     def generate_data_from_versions_markup(self, url):
-        try:
-            f = urllib2.urlopen(url)
-        except:
+        data = self.http.get(url)
+        if not data:
             raise ValueError("Couldn't open %s" % url)
 
         ret = []
-        for line in f.readlines():
+        for line in data.iter_lines():
             components = str.strip(line).split(':')
             # Skip invalid lines
             if len(components) != 4 or len(components[2]) == 0:
@@ -46,7 +47,6 @@ class GNOME:
                 ret.append(pkg)
             else:
                 print "Warning: Ignoring package %s because parsing of its name or version string '%s' failed" % (components[1], components[2])
-        f.close()
         return ret
 
     def generate_data_individual(self):


             reply	other threads:[~2017-03-03 23:51 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 23:50 Mart Raudsepp [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-07-16 20:16 [gentoo-commits] proj/gentoo-bumpchecker:master commit in: modules/ Mart Raudsepp
2022-03-27  4:48 Matt Turner
2021-12-11 22:11 Mart Raudsepp
2021-04-14 22:57 Matt Turner
2021-04-14 22:57 Matt Turner
2019-08-24 16:38 Mart Raudsepp
2019-03-26 13:33 Mart Raudsepp
2019-01-16  0:27 Mart Raudsepp
2017-10-31 23:12 Mart Raudsepp
2017-03-21  2:57 Mart Raudsepp
2017-03-21  2:29 Mart Raudsepp
2017-03-21  2:29 Mart Raudsepp
2017-03-21  2:29 Mart Raudsepp
2017-03-21  1:59 Mart Raudsepp
2017-03-21  1:59 Mart Raudsepp
2017-03-20 23:12 Mart Raudsepp
2017-03-11 14:09 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2017-03-03 23:50 Mart Raudsepp
2012-11-21 23:42 Gilles Dartiguelongue
2011-09-04 19:27 Mart Raudsepp
2011-06-07 16:36 Nirbheek Chauhan
2011-03-26  2:59 Nirbheek Chauhan
2011-03-15 13:19 Tomas Chvatal
2011-02-20 21:03 Nirbheek Chauhan
2011-02-20 13:56 Tomas Chvatal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488580134.a196c4873b3508e1f2bf60abdefe4887f2b872fb.leio@gentoo \
    --to=leio@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox