summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-14 11:07:54 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-14 11:07:54 +0100
commite65d19ee3a1e435bf2896ed829e5581eeef92dd2 (patch)
treecf5bb073899205a2f00ddeca8df8b9f3944ea835 /module/plugins/hooks
parent[HotFolder] Missing exception (diff)
downloadpyload-e65d19ee3a1e435bf2896ed829e5581eeef92dd2.tar.xz
Import cleanup for datetime and time modules
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r--module/plugins/hooks/Captcha9Kw.py10
-rw-r--r--module/plugins/hooks/CaptchaBrotherhood.py4
-rw-r--r--module/plugins/hooks/DeathByCaptcha.py4
-rw-r--r--module/plugins/hooks/DownloadScheduler.py5
-rw-r--r--module/plugins/hooks/IRCInterface.py3
-rw-r--r--module/plugins/hooks/MultiHome.py4
6 files changed, 14 insertions, 16 deletions
diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py
index 6d42416ff..825db510b 100644
--- a/module/plugins/hooks/Captcha9Kw.py
+++ b/module/plugins/hooks/Captcha9Kw.py
@@ -3,9 +3,9 @@
from __future__ import with_statement
import re
+import time
from base64 import b64encode
-from time import sleep
from module.network.HTTPRequest import BadHeader
from module.network.RequestFactory import getURL
@@ -134,7 +134,7 @@ class Captcha9Kw(Hook):
try:
res = getURL(self.API_URL, post=post_data)
except BadHeader, e:
- sleep(3)
+ time.sleep(3)
else:
if res and res.isdigit():
break
@@ -156,7 +156,7 @@ class Captcha9Kw(Hook):
'action': "usercaptchacorrectdata"})
if not result or result == "NO DATA":
- sleep(5)
+ time.sleep(5)
else:
break
else:
@@ -193,7 +193,7 @@ class Captcha9Kw(Hook):
if queue < re.search(r'queue=(\d+)', servercheck).group(1):
break
- sleep(10)
+ time.sleep(10)
else:
self.fail(_("Too many captchas in queue"))
@@ -244,7 +244,7 @@ class Captcha9Kw(Hook):
if res == "OK":
break
- sleep(5)
+ time.sleep(5)
else:
self.logDebug("Could not send %s request: %s" % (type, res))
diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py
index 5350b4f7d..161f2805b 100644
--- a/module/plugins/hooks/CaptchaBrotherhood.py
+++ b/module/plugins/hooks/CaptchaBrotherhood.py
@@ -4,13 +4,13 @@ from __future__ import with_statement
import StringIO
import pycurl
+import time
try:
from PIL import Image
except ImportError:
import Image
-from time import sleep
from urllib import urlencode
from module.network.RequestFactory import getURL, getRequest
@@ -117,7 +117,7 @@ class CaptchaBrotherhood(Hook):
ticket = res[3:]
for _i in xrange(15):
- sleep(5)
+ time.sleep(5)
res = self.api_response("askCaptchaResult", ticket)
if res.startswith("OK-answered"):
return ticket, res[12:]
diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py
index 4eefb2bff..e408dcab7 100644
--- a/module/plugins/hooks/DeathByCaptcha.py
+++ b/module/plugins/hooks/DeathByCaptcha.py
@@ -3,10 +3,10 @@
from __future__ import with_statement
import re
+import time
from base64 import b64encode
from pycurl import FORM_FILE, HTTPHEADER
-from time import sleep
from module.common.json_layer import json_loads
from module.network.HTTPRequest import BadHeader
@@ -152,7 +152,7 @@ class DeathByCaptcha(Hook):
ticket = res['captcha']
for _i in xrange(24):
- sleep(5)
+ time.sleep(5)
res = self.api_response("captcha/%d" % ticket, False)
if res['text'] and res['is_correct']:
break
diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py
index 3b7ae524c..f24faa684 100644
--- a/module/plugins/hooks/DownloadScheduler.py
+++ b/module/plugins/hooks/DownloadScheduler.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from time import localtime
+import time
from module.plugins.Hook import Hook
@@ -45,7 +44,7 @@ class DownloadScheduler(Hook):
self.logError(_("Invalid schedule"))
return
- t0 = localtime()
+ t0 = time.localtime()
now = (t0.tm_hour, t0.tm_min, t0.tm_sec, "X")
schedule = sorted([(int(x[0]), int(x[1]), 0, int(x[2])) for x in schedule] + [now])
diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py
index 1c90c0e2f..7032c6592 100644
--- a/module/plugins/hooks/IRCInterface.py
+++ b/module/plugins/hooks/IRCInterface.py
@@ -8,7 +8,6 @@ import time
from pycurl import FORM_FILE
from select import select
from threading import Thread
-from time import sleep
from traceback import print_exc
from module.Api import PackageDoesNotExists, FileDoesNotExists
@@ -116,7 +115,7 @@ class IRCInterface(Thread, Hook):
def main_loop(self):
readbuffer = ""
while True:
- sleep(1)
+ time.sleep(1)
fdset = select([self.sock], [], [], 0)
if self.sock not in fdset[0]:
continue
diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py
index 9093c8459..7ea3378ec 100644
--- a/module/plugins/hooks/MultiHome.py
+++ b/module/plugins/hooks/MultiHome.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-from time import time
+import time
from module.plugins.Hook import Hook
@@ -80,7 +80,7 @@ class Interface(object):
def useFor(self, pluginName, account):
- self.history[(pluginName, account)] = time()
+ self.history[(pluginName, account)] = time.time()
def __repr__(self):