File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 11import json
2+ import logging
23from urllib .error import HTTPError
34from urllib .parse import urlencode
45from urllib .request import build_opener , Request , ProxyHandler
1112from hcaptcha_field .widgets import hCaptchaWidget
1213
1314
15+ LOGGER = logging .getLogger ('hcaptcha_field' )
16+
17+
1418DATA_ATTRIBUTE_CONFIG = frozenset ([
1519 'theme' ,
1620 'size' ,
@@ -114,6 +118,7 @@ def validate(self, value):
114118 try :
115119 response = opener .open (request , timeout = hcaptcha_settings .TIMEOUT )
116120 except HTTPError :
121+ LOGGER .exception ("Failed to verify response with hCaptcha API." )
117122 raise ValidationError (
118123 self .error_messages ['error_hcaptcha' ],
119124 code = 'error_hcaptcha'
@@ -122,6 +127,7 @@ def validate(self, value):
122127 # Check response
123128 response_data = json .loads (response .read ().decode ('utf-8' ))
124129 if not response_data .get ('success' ):
130+ LOGGER .error ("Failed to pass hCaptcha check: %s" , response_data )
125131 raise ValidationError (
126132 self .error_messages ['invalid_hcaptcha' ],
127133 code = 'invalid_hcaptcha'
Original file line number Diff line number Diff line change 88setuptools .setup (
99 # Metadata
1010 name = 'django-hcaptcha-field' ,
11- version = '0.9' ,
11+ version = '0.9.1 ' ,
1212 license = 'BSD' ,
1313 author = 'Ties Jan Hefting' ,
1414 author_email = 'hello@tiesjan.com' ,
You can’t perform that action at this time.
0 commit comments