Reference

Cores

class flask_s3_viewer.FlaskS3Viewer(*args, **kwargs)

Bases: AWSS3Client

FLASK_S3_VIEWER_BUCKET

alias of FlaskS3ViewerBucketConfig

FLASK_S3_VIEWER_BUCKET_CONFIGS = {}
__init__(app, namespace: str | None = None, object_hostname: str | None = None, allowed_extensions: List[str] | None = None, template_namespace: str = 'base', upload_type: str = 'default', config: dict | None = None)
Parameters:
  • app (Flask.app) – Required

  • namespace (str) – Unique namespace of Flask S3Viewer

  • object_hostname (url) – Hostname, e.g. Cloudfront endpoint

  • allowed_extensions (set) – e.g. {‘jpg’, ‘png’}

  • template_namespace (str) – Template name

  • upload_type (str) – Upload type

  • config (dict) – Bucket configs

add_new_one(namespace=None, object_hostname=None, allowed_extensions=None, template_namespace='base', upload_type='default', config=None)

Initialize another bucket

Parameters:
  • namespace (str) – Unique namespace of Flask S3Viewer

  • object_hostname (url) – Hostname, e.g. Cloudfront endpoint

  • allowed_extensions (set) – e.g. {‘jpg’, ‘png’}

  • template_namespace (str) – Template name

  • upload_type (str) – Upload type

  • config (dict) – Bucket configs

Return:

FlaskS3Viewer

classmethod get_boto_client(namespace=None)

Return a Boto3’s S3 client.

Parameters:

namespace (str) – namespace

Return:

boto3’s S3 client.

classmethod get_boto_session(namespace=None)

Return a Boto3’s Sesson.

Parameters:

namespace (str) – namespace

Return:

boto3’s Session.

classmethod get_instance(namespace=None) FlaskS3Viewer

Return a Flask S3Viewer instance.

Parameters:

namespace (str) – namespace

Return:

FlaskS3Viewer

property max_items
property max_pages
register(template_folder=None)

Register FlaskS3Viewer to Flask’s blueprint.

Parameters:

template_folder (path) – FIXME

Warning

template_folder is Not ready yet. DON’T USE THIS PARAM.

template_namespace = 'flask_s3_viewer'

Region

class flask_s3_viewer.aws.ref.Region(value)

Bases: Enum

AWS Service Regions

Reference:

https://docs.aws.amazon.com/general/latest/gr/rande.html

Usage:

Region.SEOUL.value

BAHRAIN = 'me-south-1'
BEIJING = 'cn-north-1'
CALIFORNIA = 'us-west-1'
CANADA = 'ca-central-1'
FRANKFURT = 'eu-central-1'
HONGKONG = 'ap-east-1'
IRELAND = 'eu-west-1'
LONDON = 'eu-west-2'
MUMBAI = 'ap-south-1'
NINGXIA = 'cn-northwest-1'
OHIO = 'us-east-2'
OREGON = 'us-west-2'
OSAKA = 'ap-northeast-3'
PARIS = 'eu-west-3'
SAOPAULO = 'sa-east-1'
SEOUL = 'ap-northeast-2'
SINGAPORE = 'ap-southeast-1'
STOCKHOLM = 'eu-north-1'
SYDNEY = 'ap-southeast-2'
TOKYO = 'ap-northeast-1'
VIRGINIA = 'us-east-1'