Browse Source

Remove unused SickBeardURLOpener and AuthURLOpener classes

pull/228/head
Adam 10 years ago
parent
commit
87d46b2c3f
  1. 1
      CHANGES.md
  2. 51
      sickbeard/classes.py
  3. 2
      sickbeard/helpers.py

1
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]

51
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 <http://www.gnu.org/licenses/>.
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:

2
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):
'''

Loading…
Cancel
Save