I am currently using the boto3 library to manipulate the s3 via:

import boto3

bucket = 'pobook'
region = 'ca-central-1'
aws_akey = '################'
aws_skey = '##################################'

myfs = S3FS(
            bucket,
            aws_access_key_id=aws_akey,
            aws_secret_access_key=aws_skey,
            region=region
            )

#s3fs = S3FS(bucket, aws_access_key_id="AKIAISLT7VNRCBEKP3EA", 
aws_secret_access_key="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", 
region="ca-central-1")

s3conn = boto3.Session(
    aws_access_key_id=aws_akey,
    aws_secret_access_key=aws_skey,
    region_name=region
)

s3 = s3conn.resource("s3")

def s3delete(bucket, file_name):
    if not (bucket == None) and not (file_name == None):
        obj = s3.Object(bucket, file_name)
        obj.delete()
        return True
    else:
        return False




On Friday, 8 June 2018 14:21:17 UTC-7, watr wrote:
>
> I am running web2py from source pulled from github master this morning.
>
> Here is my code:
> from fs_s3 import S3FS
> import datetime
>
> bucket = "pobook"
> region = 'ca-central-1'
> aws_akey = "##############"
> aws_skey = "########################"
>
> myfs = S3FS(
>             bucket,
>             aws_access_key_id=aws_akey,
>             aws_secret_access_key=aws_skey,
>             region=region
>             )
>
> db.define_table('attachments',
>                 Field('name', 'string', requires=IS_NOT_EMPTY()),
>                 Field('files', 'upload', uploadfs = myfs, autodelete=True)
>                 )
>
> However, the default SQLFORM.grid "file" link gives a local link, not a 
> link to the S3 file, so it fails. I created a download button to get around 
> this.
>
> I am unable to use the "Delete" or default "file" download link in 
> SQLFORM.grid.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to