你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

functions Package

Packages

decorators
extension

Modules

blob
cosmosdb
durable_functions
eventgrid
eventhub
http
kafka
meta
queue
servicebus
sql
timer
warmup

Classes

AppExtensionBase

An abstract class defines the global life-cycle hooks to be implemented by customer's extension, will be applied to all functions.

An AppExtension should be treated as a static class. Must not contain init method since it is not instantiable.

Please place your initialization code in init() classmethod, consider accepting extension settings in configure() classmethod from customers.

AsgiFunctionApp

Constructor of AsgiFunctionApp object.

present on the request in order to invoke the function. :param function_name: function name

AsgiMiddleware

This middleware is to adapt an ASGI supported Python server framework into Azure Functions. It can be used by either calling the .handle() function or exposing the .main property in a HttpTrigger.

Instantiate an ASGI middleware to convert Azure Functions HTTP request into ASGI Python object. Example on handling ASGI app in a HTTP trigger by overwriting the .main() method:

import azure.functions as func

from FastapiApp import app

main = func.AsgiMiddleware(app).main

BindingApi

Interface to extend for using existing binding decorator functions.

Blueprint

Functions container class where all the functions loaded in it can be registered in FunctionRegister subclasses but itself can not be indexed directly. The class contains all existing supported trigger and binding decorator functions.

Context

Function invocation context.

DecoratorApi

Interface which contains essential decorator function building blocks to extend for creating new function app or blueprint classes.

Document

An Azure Document.

Document objects are UserDict subclasses and behave like dicts.

DocumentList

A UserList subclass containing a list of Document objects

EntityContext

A durable function entity context.

EventGridEvent

An EventGrid event message.

EventGridOutputEvent

An EventGrid event message.

EventHubEvent

A concrete implementation of Event Hub message type.

ExtensionMeta

The metaclass handles extension registration.

AppExtension is registered in init, it is applied to all triggers. FuncExtension is registered in call, as users need to instantiate it inside hook script.

After registration, the extension class will be flatten into the following structure to speed up worker lookup:

_func_exts[<trigger_name>].<hook_name>.(ext_name, ext_impl) (e.g. _func_exts['HttpTrigger'].pre_invocation.ext_impl)

_app_exts.<hook_name>.(ext_name, ext_impl) (e.g. _app_exts.pre_invocation_app_level.ext_impl)

The extension tree information is stored in _info for diagnostic purpose. The dictionary is serializable to json:

_info['FuncExtension'][''] = list() _info['AppExtension'] = list()

Executes on 'import extension', once the AppExtension class is loaded, call the setup() method and add the life-cycle hooks into _app_exts.

ExternalHttpFunctionApp

Interface to extend for building third party http function apps.

Interface for declaring top level function app class which will be directly indexed by Python Function runtime.

on the request in order to invoke the function. :param args: Variable length argument list. :param kwargs: Arbitrary keyword arguments.

FuncExtensionBase

An abstract class defines the life-cycle hooks which to be implemented by customer's extension.

Everytime when a new extension is initialized in customer function scripts, the ExtensionManager._func_exts field records the extension to this specific function name.

Constructor for extension. This needs to be implemented and ensure super().init(file_path) is called.

The initializer serializes the extension to a tree. This speeds up the worker lookup and reduce the overhead on each invocation. _func_exts[<trigger_name>].<hook_name>.(ext_name, ext_impl) (e.g. _func_exts['HttpTrigger'].pre_invocation.ext_impl)

Function

The function object represents a function in Function App. It encapsulates function metadata and callable and used in the worker function indexing model. Ref: https://aka.ms/azure-function-ref

Constructor of <xref:azure.functions.FunctionBuilder> object.

FunctionApp

FunctionApp object used by worker function indexing model captures user defined functions and metadata.

Ref: https://aka.ms/azure-function-ref

Constructor of FunctionApp object.

present on the request in order to invoke the function.

FunctionExtensionException

Exception emitted from Azure Functions Python Worker extension

FunctionRegister

Interface for declaring top level function app class which will be directly indexed by Python Function runtime.

on the request in order to invoke the function. :param args: Variable length argument list. :param kwargs: Arbitrary keyword arguments.

HttpRequest

An HTTP request object.

HttpResponse

An HTTP response object.

InputStream

File-like object representing an input blob.

KafkaConverter
KafkaEvent

A concrete implementation of Kafka event message type.

KafkaTriggerConverter
OrchestrationContext

A durable function orchestration context.

Out

An interface to set function output parameters.

QueueMessage

A Queue message object.

ServiceBusMessage

A ServiceBuss message object.

SettingsApi

Interface to extend for using existing settings decorator in functions.

SqlRow

A SQL Row.

SqlRow objects are ''UserDict'' subclasses and behave like dicts.

SqlRowList

A ''UserList'' subclass containing a list of :class:'~SqlRow' objects

TimerRequest

Timer request object.

TriggerApi

Interface to extend for using existing trigger decorator functions.

WsgiFunctionApp

Constructor of WsgiFunctionApp object.

WsgiMiddleware

This middleware is to adapt a WSGI supported Python server framework into Azure Functions. It can be used by either calling the .handle() function or exposing the .main property in a HttpTrigger.

Instantiate a WSGI middleware to convert Azure Functions HTTP request into WSGI Python object. Example on handling WSGI app in a HTTP trigger by overwriting the .main() method:

import azure.functions as func

from FlaskApp import app

main = func.WsgiMiddleware(app.wsgi_app).main

Enums

AccessRights

Access rights for the connection string. The default is manage, which indicates that the connection has the Manage permission.

AuthLevel

Azure HTTP authorization level, determines what keys, if any, need to be present on the request in order to invoke the function.

BlobSource

Source of the blob trigger.

Cardinality

Used for all non-C# languages. Set to many in order to enable batching. If omitted or set to one, a single message is passed to the function.

DataType

Data type of the binding used in function.json

HttpMethod

All http methods Azure Python function supports.

Functions

get_binding_registry

get_binding_registry()