MCPcopy Create free account
hub / github.com/authlib/authlib / invalid_error_characters

Function invalid_error_characters

authlib/oauth2/base.py:5–20  ·  view source on GitHub ↗

Check whether the string only contains characters from the restricted ASCII set defined in RFC6749 for errors. :rfc:`6749#section-4.1.2.1`

(text: str)

Source from the content-addressed store, hash-verified

3
4
5def invalid_error_characters(text: str) -> list[str]:
6 """Check whether the string only contains characters from the restricted ASCII set defined in RFC6749 for errors.
7
8 :rfc:`6749#section-4.1.2.1`
9 """
10 valid_ranges = [
11 (0x20, 0x21),
12 (0x23, 0x5B),
13 (0x5D, 0x7E),
14 ]
15
16 return [
17 char
18 for char in set(text)
19 if not any(start <= ord(char) <= end for start, end in valid_ranges)
20 ]
21
22
23class OAuth2Error(AuthlibHTTPError):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected