This topic describes handlers and how to configure handlers in Python runtime environments in Function Compute.

What is a handler?

A handler for a function in FC is the method that is used to process requests in function code. When a function in FC is invoked, Function Compute uses the handler that you configure to process requests. You can configure a handler by specifying a value for the Request Handler parameter in the Function Compute console. The request handler that you specify is the handler of the function.

For FC functions in Python, your request handler must be in the File name.Method name format. For example, if your file name is main.py and your method name is handler, the handler is main.handler.

For more information about the definitions and operations of functions in FC, see Manage functions.

Configure a handler

When you configure a handler, make sure that you follow the configuration specifications that are described in Function Compute. The configuration specifications vary based on the handler type.

Handlers are classified into event handlers and HTTP handlers. Event requests are generated by event sources, and HTTP requests are generated by HTTP triggers. For more information, see Function types.

For examples on how to configure a request handler, see Event handlers and HTTP request handler (HTTP Handler).

References

For more information about how to deploy a code package to Function Compute, see Deploy a code package.