replace urllib.urlopen (which was marked as deprecated) with urllib2.urlopen

This commit is contained in:
Marcos Pinto 2008-07-18 04:10:01 +00:00
parent dac01416f0
commit 4ac5d43d58
1 changed files with 6 additions and 5 deletions

View File

@ -863,15 +863,16 @@ class Core(
# check if we've done this within the last week or never # check if we've done this within the last week or never
if (now - self.config["info_sent"]) >= (60 * 60 * 24 * 7): if (now - self.config["info_sent"]) >= (60 * 60 * 24 * 7):
import deluge.common import deluge.common
import urllib from urllib import quote_plus
from urllib2 import urlopen
import platform import platform
try: try:
url = "http://deluge-torrent.org/stats_get.php?processor=" + \ url = "http://deluge-torrent.org/stats_get.php?processor=" + \
platform.machine() + "&python=" + platform.python_version() \ platform.machine() + "&python=" + platform.python_version() \
+ "&deluge=" + deluge.common.get_version() \ + "&deluge=" + deluge.common.get_version() \
+ "&os=" + platform.system() \ + "&os=" + platform.system() \
+ "&plugins=" + urllib.quote_plus(self.config["enabled_plugins"]) + "&plugins=" + quote_plus(self.config["enabled_plugins"])
urllib.urlopen(url) urlopen(url)
except IOError, e: except IOError, e:
log.debug("Network error while trying to send info: %s", e) log.debug("Network error while trying to send info: %s", e)
else: else:
@ -881,9 +882,9 @@ class Core(
def get_new_release(self): def get_new_release(self):
log.debug("get_new_release") log.debug("get_new_release")
import urllib from urllib2 import urlopen
try: try:
self.new_release = urllib.urlopen( self.new_release = urlopen(
"http://download.deluge-torrent.org/version-1.0").read().strip() "http://download.deluge-torrent.org/version-1.0").read().strip()
except Exception, e: except Exception, e:
log.debug("Unable to get release info from website: %s", e) log.debug("Unable to get release info from website: %s", e)