From 87d46b2c3f041807974eb18dd50e18ac4ab2dd00 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 24 Feb 2015 15:01:12 +0800 Subject: [PATCH] Remove unused SickBeardURLOpener and AuthURLOpener classes --- CHANGES.md | 1 + sickbeard/classes.py | 51 ++------------------------------------------ sickbeard/helpers.py | 2 -- 3 files changed, 3 insertions(+), 51 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0455f568..59c1d32e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ * Remove unused libraries fuzzywuzzy and pysrt * Change webserve code to a logical layout and PEP8 * Add text to explain params passed to extra scripts on Config/Post Processing +* Remove unused SickBeardURLOpener and AuthURLOpener classes [develop changelog] diff --git a/sickbeard/classes.py b/sickbeard/classes.py index 0094ba08..7cc56bee 100644 --- a/sickbeard/classes.py +++ b/sickbeard/classes.py @@ -16,58 +16,11 @@ # You should have received a copy of the GNU General Public License # along with SickGear. If not, see . import re - +import datetime import sickbeard -import urllib -import datetime from lib.dateutil import parser - -from common import USER_AGENT, Quality - - -class SickBeardURLopener(urllib.FancyURLopener): - version = USER_AGENT - - -class AuthURLOpener(SickBeardURLopener): - """ - URLOpener class that supports http auth without needing interactive password entry. - If the provided username/password don't work it simply fails. - - user: username to use for HTTP auth - pw: password to use for HTTP auth - """ - - def __init__(self, user, pw): - self.username = user - self.password = pw - - # remember if we've tried the username/password before - self.numTries = 0 - - # call the base class - urllib.FancyURLopener.__init__(self) - - def prompt_user_passwd(self, host, realm): - """ - Override this function and instead of prompting just give the - username/password that were provided when the class was instantiated. - """ - - # if this is the first try then provide a username/password - if self.numTries == 0: - self.numTries = 1 - return (self.username, self.password) - - # if we've tried before then return blank which cancels the request - else: - return ('', '') - - # this is pretty much just a hack for convenience - def openit(self, url): - self.numTries = 0 - return SickBeardURLopener.open(self, url) +from sickbeard.common import Quality class SearchResult: diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 6ceb914c..d723d77e 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -65,8 +65,6 @@ from sickbeard import clients from lib.cachecontrol import CacheControl, caches from itertools import izip, cycle -urllib._urlopener = classes.SickBeardURLopener() - def indentXML(elem, level=0): '''