Data Structures — Aquilia Documentation
Comprehensive guide and documentation for Data Structures in the Aquilia framework. View API reference, examples, and implementation patterns.
Request / Data Structures Data Structures Aquilia provides performance-optimized, purpose-built data structures in aquilia._datastructures for request parsing: MultiDict for multi-value dictionaries, Headers for case-insensitive header access, and URL for immutable URL component parsing and manipulation. MultiDict A dictionary that supports multiple values per key. Implements MutableMapping. Used internally for query parameters and form data where keys can repeat (e.g. ?tag=python&tag=async). from aquilia._datastructures import MultiDict # Initialize from list of tuples params = MultiDict([ ("tag", "python"), ("tag", "async"), ("page", "1"), ]) # Standard dict access (returns FIRST value for key) params["tag"] # → "python" params.get("tag") # → "python" # Multi-value access params.get_all("tag") # → ["python", "async"] # Add values (doesn't replace) params.add("tag", "web") params.get_all("tag") # → ["python", "async", "web"] # Convert to plain dict (first value per key) params.to_dict() # → API Reference Method Returns Description , , , , ].map((row, i) => ( ))} Headers A case-insensitive header container built as a @dataclass. Eagerly processes and decodes raw header bytes from the ASGI scope while preserving original naming. from aquilia._datastructures import Headers headers = Headers(raw=[ (b"content-type", b"application/json"), (b"Authorization", b"Bearer abc123"), ]) # Case-insensitive lookup headers.get("Content-Type") # → "application/json" headers.has("authorization") # → True URL An immutable parsed URL component representation supporting modifications via copies. from aquilia._datastructures import URL url = URL.parse("https://api.example.com/users?page=2") url.host # → "api.example.com" url.path # → "/users" # Immutable replacement pattern url2 = url.replace(path="/articles") Response File Uploads )
Go to Homepage