mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 05:13:16 -07:00
don't need user/pass when using api. fix #142
This commit is contained in:
parent
3a253d4525
commit
41130030c1
10 changed files with 30 additions and 125 deletions
|
@ -12,24 +12,6 @@ from nzbToMediaEnv import *
|
|||
|
||||
Logger = logging.getLogger()
|
||||
|
||||
class AuthURLOpener(urllib.FancyURLopener):
|
||||
def __init__(self, user, pw):
|
||||
self.username = user
|
||||
self.password = pw
|
||||
self.numTries = 0
|
||||
urllib.FancyURLopener.__init__(self)
|
||||
|
||||
def prompt_user_passwd(self, host, realm):
|
||||
if self.numTries == 0:
|
||||
self.numTries = 1
|
||||
return (self.username, self.password)
|
||||
else:
|
||||
return ('', '')
|
||||
|
||||
def openit(self, url):
|
||||
self.numTries = 0
|
||||
return urllib.FancyURLopener.open(self, url)
|
||||
|
||||
def process(dirName, nzbName=None, status=0):
|
||||
|
||||
status = int(status)
|
||||
|
@ -45,8 +27,6 @@ def process(dirName, nzbName=None, status=0):
|
|||
|
||||
host = config.get("Gamez", "host")
|
||||
port = config.get("Gamez", "port")
|
||||
username = config.get("Gamez", "username")
|
||||
password = config.get("Gamez", "password")
|
||||
apikey = config.get("Gamez", "apikey")
|
||||
|
||||
try:
|
||||
|
@ -59,8 +39,6 @@ def process(dirName, nzbName=None, status=0):
|
|||
except ConfigParser.NoOptionError:
|
||||
web_root = ""
|
||||
|
||||
myOpener = AuthURLOpener(username, password)
|
||||
|
||||
if ssl:
|
||||
protocol = "https://"
|
||||
else:
|
||||
|
@ -79,7 +57,7 @@ def process(dirName, nzbName=None, status=0):
|
|||
Logger.debug("Opening URL: %s", url)
|
||||
|
||||
try:
|
||||
urlObj = myOpener.openit(url)
|
||||
urlObj = urllib.urlopen(url)
|
||||
except:
|
||||
Logger.exception("Unable to open URL")
|
||||
return 1 # failure
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue