request.json()
is actually a coroutine that needs to be awaited, this design prevents the entire JSON being uploaded in-memory before the route requires it.request.form
or through the request.files
list. Both methods are co-routines that will consume the request.stream
and store the file in-disk if it's too big to keep in-memory.request.load_form(threshold=1 * 1024 * 1024)
explicitly, in this case files bigger than 1mb will be flushed to disk.Please be aware that the form threshold does not passthrough the max_body_size limit so you'll still need to configure your route properly.
request.stream_form()
and deal with every uploaded field as it arrives by the network. This is good when you don't want files hitting the disk and in some scenarios allows you to waste less memory by doing way more coding yourself.request.stream
method provides an easy way to consume the stream by ourself.request.url
: Raw URLrequest.parsed_url
: A parsed URL where you can access the path, host and all URL attributes easily. The URL is parsed by a fast Cython parser so there is no need to you re-invent the wheel.