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)
| 3 | |
| 4 | |
| 5 | def 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 | |
| 23 | class OAuth2Error(AuthlibHTTPError): |