summaryrefslogtreecommitdiffstats
path: root/captcha/captcha.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-30 13:11:55 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-30 13:11:55 +0200
commit5ce2a1b305825da5bd1d13d77c38af21a0803141 (patch)
tree35069f4a078870ddbd151e1f4c2720aa392e4444 /captcha/captcha.py
parentrapidshare fix (diff)
downloadpyload-5ce2a1b305825da5bd1d13d77c38af21a0803141.tar.xz
little captcha improvements
Diffstat (limited to 'captcha/captcha.py')
-rw-r--r--captcha/captcha.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/captcha/captcha.py b/captcha/captcha.py
index 7092e21c1..22c097f38 100644
--- a/captcha/captcha.py
+++ b/captcha/captcha.py
@@ -226,8 +226,29 @@ class OCR(object):
return letters
+ def correct(self, values, var=None):
+
+ if var:
+ result = var
+ else:
+ result = self.result_captcha
+
+ for key, item in values.iteritems():
+
+ if key.__class__ == str:
+ print key, "->", item
+ result = result.replace(key, item)
+ else:
+ for expr in key:
+ print expr, "->", item
+ result = result.replace(expr, item)
+
+ if var:
+ return result
+ else:
+ self.result_captcha = result
+
-
if __name__ == '__main__':
ocr = OCR()
ocr.load_image("B.jpg")