summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/Ftp.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-09-29 22:43:17 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-09-29 22:43:17 +0200
commit3353ea228835ffa96cc73d5b5e23f6d92ba84203 (patch)
treec593079745e1a65c39bfa59b3a3b6a07e1b05486 /module/plugins/hoster/Ftp.py
parent[OpenloadIo] Cleanup (diff)
downloadpyload-3353ea228835ffa96cc73d5b5e23f6d92ba84203.tar.xz
Update hoster plugins
Diffstat (limited to 'module/plugins/hoster/Ftp.py')
-rw-r--r--module/plugins/hoster/Ftp.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py
index c9f5fa6b6..2fa5c1aa8 100644
--- a/module/plugins/hoster/Ftp.py
+++ b/module/plugins/hoster/Ftp.py
@@ -11,7 +11,7 @@ from module.plugins.internal.Hoster import Hoster
class Ftp(Hoster):
__name__ = "Ftp"
__type__ = "hoster"
- __version__ = "0.54"
+ __version__ = "0.55"
__status__ = "testing"
__pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+'
@@ -29,10 +29,10 @@ class Ftp(Hoster):
def process(self, pyfile):
- parsed_url = urlparse.urlparse(pyfile.url)
- netloc = parsed_url.netloc
+ p_url = urlparse.urlparse(pyfile.url)
+ netloc = p_url.netloc
- pyfile.name = parsed_url.path.rpartition('/')[2]
+ pyfile.name = p_url.path.rpartition('/')[2]
try:
pyfile.name = urllib.unquote(str(pyfile.name)).decode('utf8')
@@ -40,20 +40,30 @@ class Ftp(Hoster):
pass
if not "@" in netloc:
- servers = [x['login'] for x in self.account.getAllAccounts()] if self.account else []
+ self.log_debug("Auth required")
+
+ #@TODO: Recheck in 0.4.10
+ if self.account:
+ servers = [x['login'] for x in self.account.getAllAccounts()]
+ else:
+ servers = []
if netloc in servers:
self.log_debug("Logging on to %s" % netloc)
- self.req.addAuth(self.account.get_info(netloc)['login']['password'])
+ self.req.addAuth(self.account.get_login('password'))
+
else:
pwd = self.get_password()
if ':' in pwd:
self.req.addAuth(pwd)
+ else:
+ self.fail(_("Authorization required"))
self.req.http.c.setopt(pycurl.NOBODY, 1)
try:
res = self.load(pyfile.url)
+
except pycurl.error, e:
self.fail(_("Error %d: %s") % e.args)