Skip to content

Add support for generating storage upload policies and signatures #2861

@theacodes

Description

@theacodes

Details

A policy (and its associated signature) allows a web application to create a form that allows user agents to directly upload to Google Cloud Storage. This is a pretty useful feature and it would be great if this client library could make that easier.

A rough idea:

storage = google.cloud.storage.Client()

policy = storage.policy(
    bucket='my-bucket',
    acl='bucket-owner-read',
    succes_action_redirection=url_for('upload_success'),
    content_type='image/jpeg',
    content_length_range=(0, 1024*10))

encoded = policy.encoded
signature = policy.signature

for field_name, field_value in policy:
    # HTML field names and values

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.authtype: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions