summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/CaptchaService.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/internal/CaptchaService.py')
-rw-r--r--module/plugins/internal/CaptchaService.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py
index ec938079a..b6afad22a 100644
--- a/module/plugins/internal/CaptchaService.py
+++ b/module/plugins/internal/CaptchaService.py
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
+import random
import re
import time
+import urlparse
from base64 import b64encode
-from random import random, randint
-from urlparse import urljoin, urlparse
from module.common.json_layer import json_loads
from module.plugins.Plugin import Base
@@ -155,7 +155,7 @@ class ReCaptcha(CaptchaService):
self.logDebug("Time: %s" % millis)
- rand = randint(1, 99999999)
+ rand = random.randint(1, 99999999)
a = "0.%s" % str(rand * 2147483647)
rpc = int(100000000 * float(a))
@@ -167,7 +167,7 @@ class ReCaptcha(CaptchaService):
def _challenge_v2(self, key, parent=None):
if parent is None:
try:
- parent = urljoin("http://", urlparse(self.plugin.pyfile.url).netloc)
+ parent = urlparse.urljoin("http://", urlparse.urlparse(self.plugin.pyfile.url).netloc)
except Exception:
parent = ""
@@ -214,7 +214,7 @@ class ReCaptcha(CaptchaService):
self.logDebug("Result: %s" % response)
timeToSolve = int(round(time.time() * 1000)) - millis_captcha_loading
- timeToSolveMore = timeToSolve + int(float("0." + str(randint(1, 99999999))) * 500)
+ timeToSolveMore = timeToSolve + int(float("0." + str(random.randint(1, 99999999))) * 500)
html = self.plugin.req.load("https://www.google.com/recaptcha/api2/userverify",
post={'k' : key,
@@ -296,7 +296,7 @@ class AdsCaptcha(CaptchaService):
def result(self, server, challenge):
result = self.plugin.decryptCaptcha("%sChallenge.aspx" % server,
- get={'cid': challenge, 'dummy': random()},
+ get={'cid': challenge, 'dummy': random.random()},
cookies=True,
imgtype="jpg")