0
votes

https://cloud.google.com/storage/docs/json_api/v1/json-api-python-samples

Using the example above, I was able to get the file to upload to a bucket. However I am unable to get this to upload to a folder within a bucket.

The Error: "Invalid bucket name:"

Appreciate any help!

1

1 Answers

0
votes

Under the

def upload_object(bucket, filename, readers, owners):
    service = create_service()

    # This is the request body as specified:
    # http://g.co/cloud/storage/docs/json_api/v1/objects/insert#request
    body = {
        'name': 'foldername/' + filename,
    }

Add 'foldername/' + filename.

This will direct it to the proper location.