Skip to content

Commit

Permalink
fixup: Format Python code with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
Geek.Zone/Bot authored and Freshrojek committed Apr 19, 2021
1 parent 5b16e31 commit 2160cb8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions memberships/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,19 @@
from .tokens import email_verification_token
from .tasks import task_send_email


def validate_recaptcha(response):
url = 'https://www.google.com/recaptcha/api/siteverify'
url = "https://www.google.com/recaptcha/api/siteverify"
secret = settings.RECAPTCHA_SECRET_KEY
payload = {
'secret': secret,
'response': response
}
payload = {"secret": secret, "response": response}
data = urllib.parse.urlencode(payload).encode("utf-8")
request = urllib.request.Request(url, data=data)
response = urllib.request.urlopen(request)
result = json.loads(response.read().decode())
success = result.get('success')
success = result.get("success")

if (not result.get('success')) or (float(result.get('score')) < 0.5):
return 'fail'
if (not result.get("success")) or (float(result.get("score")) < 0.5):
return "fail"

return result

Expand Down

0 comments on commit 2160cb8

Please sign in to comment.