mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* Updating Python hot HTTP sample - using latest hotfn 0.0.5 release (made life lot easier) * Updating to latest 0.0.6 release What's new? - new request data signature: context, data, loop - supports event loop (very useful for request body handeler of coroutine type) * Updating example with respect to recent fdk-python release * Addressing review comments
22 lines
519 B
Python
22 lines
519 B
Python
import fdk
|
|
|
|
|
|
@fdk.coerce_http_input_to_content_type
|
|
def app(context, data=None, loop=None):
|
|
"""
|
|
User's request body handler
|
|
:param context: request context
|
|
:type context: hotfn.http.request.RequestContext
|
|
:param data: request body, it's type depends on request Content-Type header
|
|
:type data: object
|
|
:param loop: asyncio event loop
|
|
:type loop asyncio.AbstractEventLoop
|
|
:return: echo of data
|
|
:rtype: object
|
|
"""
|
|
return data
|
|
|
|
|
|
if __name__ == "__main__":
|
|
fdk.handle(app)
|