Bundled grammars¶
abnf.grammars contains a Rule subclass for each of the RFCs below. Import the
module and use its Rule to parse:
from abnf.grammars import rfc5322
rfc5322.Rule("address").parse_all("test@example.com")
Some modules import rules by reference from others (for example, several HTTP
extensions reuse token and OWS from RFC 7230); this composition happens
automatically at import time. See Write your own grammar module
for how it is wired.
HTTP core¶
Module |
RFC |
Subject |
|---|---|---|
|
2616 |
HTTP/1.1 (obsolete; a few rules are reused by later RFCs) |
|
7230 |
HTTP/1.1 message syntax and routing (obsolete → 9110/9112) |
|
7231 |
HTTP/1.1 semantics and content (obsolete → 9110) |
|
7232 |
HTTP/1.1 conditional requests (obsolete → 9110) |
|
7233 |
HTTP/1.1 range requests (obsolete → 9110) |
|
7234 |
HTTP/1.1 caching (obsolete → 9111) |
|
7235 |
HTTP/1.1 authentication (obsolete → 9110) |
|
9110 |
HTTP semantics |
|
9111 |
HTTP caching |
HTTP extension headers¶
Module |
RFC |
Subject |
|---|---|---|
|
6265 |
HTTP state management (cookies) |
|
6266 |
|
|
6797 |
HTTP Strict Transport Security ( |
|
7239 |
|
|
7240 |
|
|
7838 |
HTTP alternative services ( |
|
8288 |
Web linking ( |
|
9651 |
Structured field values for HTTP (obsoletes 8941) |
Email¶
Module |
RFC |
Subject |
|---|---|---|
|
5322 |
Internet Message Format (email addresses, headers) |
|
7489 |
DMARC |
URIs, IRIs and encoding¶
Module |
RFC |
Subject |
|---|---|---|
|
3986 |
URI generic syntax |
|
3987 |
Internationalized Resource Identifiers (IRIs) |
|
3629 |
UTF-8 |
|
5987 |
encoding for HTTP header parameters (obsolete → 8187) |
|
8187 |
character encoding and language for HTTP header parameters |
Dates, ABNF itself, and more¶
Module |
RFC |
Subject |
|---|---|---|
|
3339 |
date and time on the internet (timestamps) |
|
5234 |
ABNF itself, plus the core rules (see |
|
7405 |
case-sensitive string support in ABNF |
|
9051 |
IMAP4rev2 |
|
9116 |
|
Tip
The module source is itself the best worked example of writing a grammar —
abnf.grammars.rfc7230 in particular shows importing rules from another
Rule subclass.