Skip to content

DigitalOcean functions addons. Typed Event and Context class.

Notifications You must be signed in to change notification settings

victorbmlabs/do-function-addons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DigitalOcean Function Addons

How to use

  1. Install from PyPi
  2. Import Event and Context from function_addons.request
  3. Change your DO Functions function signature to (event: Event, context: Context)

Adding custom event keys

DigitalOcean functions adds any extra request body to Event. Simply extend the Event class with your custom attributes for typing support.

from function_addons.request import Event, Context

class MyEvent(Event):
    data: object

def main(event: MyEvent, context: Context):
    data = event["data"] 

Make sure to either use .get() or except KeyError as this doesn't validate if the key is actually present.

About

DigitalOcean functions addons. Typed Event and Context class.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages