diff --git a/tests/unit/captcha/test_hcaptcha.py b/tests/unit/captcha/test_hcaptcha.py index 07797eb22aa2..920236466248 100644 --- a/tests/unit/captcha/test_hcaptcha.py +++ b/tests/unit/captcha/test_hcaptcha.py @@ -183,7 +183,7 @@ def test_invalid_error_code(self): responses.add( responses.POST, hcaptcha.VERIFY_URL, - json={"success": False, "error_codes": ["foo"]}, + json={"success": False, "error-codes": ["foo"]}, ) serv = hcaptcha.Service.create_service(context=None, request=_REQUEST) @@ -200,7 +200,7 @@ def test_valid_error_code(self): hcaptcha.VERIFY_URL, json={ "success": False, - "error_codes": ["invalid-or-already-seen-response"], + "error-codes": ["invalid-or-already-seen-response"], }, ) serv = hcaptcha.Service.create_service(context=None, request=_REQUEST) diff --git a/warehouse/captcha/hcaptcha.py b/warehouse/captcha/hcaptcha.py index f417b8a6909a..9588847649d1 100644 --- a/warehouse/captcha/hcaptcha.py +++ b/warehouse/captcha/hcaptcha.py @@ -149,7 +149,7 @@ def verify_response(self, response, remote_ip=None) -> ChallengeResponse | None: if resp.status_code != http.HTTPStatus.OK or not data["success"]: try: - error_codes = data["error_codes"] + error_codes = data["error-codes"] except KeyError as e: raise UnexpectedError( f"Response missing 'error-codes' key: {data}"