Python - bucket()

Create a new bucket for storing and retrieving files.

from nitric.resources import bucket
from nitric.application import Nitric
assets = bucket('assets').allow('read', 'write', 'delete')
Nitric.run()

Earlier versions of the Nitric SDK used 'reading', 'writing' and 'deleting'. The latest version uses 'read', 'write' and 'delete'.

Parameters

  • Name
    name
    Required
    Required
    Type
    string
    Description

    The unique name of this bucket within the app. Subsequent calls to bucket with the same name will return the same object.

Access

All Nitric resources provide access permissions you can use to specify the level of access your service needs to the resource. See here for details about infrastructure security.

Available permissions:


reading

This permission allows your function to read files from the bucket


writing

This permission allows your function to write files to the bucket


deleting

This permission allows your function to delete files from the bucket


Working with files

See the following for examples on working with files in a bucket:

Last updated on Nov 18, 2024