Files
fission-src/examples/python
Soam VasaniandTa-Ching Chen 4e4c8aa14f Switch from fluentd to fluentbit for log forwarding (#1086)
This removes fluentd in favor of using fluentbit, which is lighter (in
memory usage) and seems to be more actively maintained.

Fluentbit's config file format is different from fluentd's.  It also
doesn't support the same record modification stuff that fluentd
supports, so we have to change the influxdb query slightly.  This
means that after an upgrade, the new CLI may won't work for querying older 
logs.  Hopefully, this slight breakage is acceptable; if users 
really need older logs they can use the older CLI.
2019-03-18 15:42:37 +08:00
..
2018-01-30 12:00:30 -08:00
2016-11-19 20:04:46 -08:00
2016-12-08 14:13:01 -08:00

Python Examples

This directory contains a Python examples to show different the features of the Fission Python environment:

  • hello.py is a simple Pythonic hello world function.
  • requestdata.py shows how you can access the HTTP request fields, such as the body, headers and query.
  • statuscode.py is an example of how you can change the response status code.
  • multifile/ shows how to create Fission Python functions with multiple source files.
  • guestbook/ is a more realistic demonstration of using Python and Fission to create a serverless guestbook.
  • sourcepkg/ is an example of how to use the Fission Python Build environment to resolve (pip) dependencies before deploying the function.

Getting Started

Create a Fission Python environment with the default Python runtime image (this does not include the build environment):

fission environment create --name python --image fission/python-env

Use the hello.py to create a Fission Python function:

fission function create --name hello-py --env python --code hello.py 

Test the function:

fission function test --name hello-py

For a full guide see the official documentation on Python with Fission.