[tor-commits] [bridgedb/master] Pep8 fixes for bridgedb.captcha.ReCaptcha.get() method.
isis at torproject.org
isis at torproject.org
Sun Mar 16 19:04:58 UTC 2014
commit 0983e568d64c11058f6d86df1ea6f479f061ad5b
Author: Isis Lovecruft <isis at torproject.org>
Date: Tue Mar 4 19:06:21 2014 +0000
Pep8 fixes for bridgedb.captcha.ReCaptcha.get() method.
---
lib/bridgedb/captcha.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/captcha.py b/lib/bridgedb/captcha.py
index 5d36432..2e175f8 100644
--- a/lib/bridgedb/captcha.py
+++ b/lib/bridgedb/captcha.py
@@ -95,16 +95,17 @@ class ReCaptcha(Captcha):
stored at ``ReCaptcha.image`` and the challenge string at
``ReCaptcha.challenge``.
"""
- if (self.pubkey == '') or (self.privkey == ''):
+ if not self.pubkey or not self.privkey:
raise ReCaptchaKeyError
+
urlbase = API_SSL_SERVER
form = "/noscript?k=%s" % self.pubkey
# extract and store image from captcha
- html = urllib2.urlopen(urlbase+form).read()
+ html = urllib2.urlopen(urlbase + form).read()
soup = BeautifulSoup(html)
- imgurl = urlbase+"/"+ soup.find('img')['src']
- self.challenge = str(soup.find('input', {'name' : 'recaptcha_challenge_field'})['value'])
+ imgurl = urlbase + "/" + soup.find('img')['src']
+ self.challenge = str(soup.find('input', {'name': 'recaptcha_challenge_field'})['value'])
self.image = urllib2.urlopen(imgurl).read()
More information about the tor-commits
mailing list