A context manager for interfacing with S3.
Return content_type of file. If file does not have a content_type, make a guess.
Configure OpenS3 object to write to or read from a specific S3 object.
Parameters: |
|
---|
Modes
mode | Description |
---|---|
‘rb’ | open for reading (default) |
‘wb’ | open for writing, truncating the file first |
‘ab’ | open for writing, appending to the end of the file if it exists |
Access Control List (acl)
Valid values include:
- private (default)
- public-read
- public-read-write
- authenticated-read
- bucket-owner-read
- bucket-owner-full-control
Return an base64 encoded byte string as an ENCODING decoded string
Returns the given string converted to a string that can be used for a clean filename. Specifically, leading and trailing spaces are removed; other spaces are converted to underscores; and anything that is not a unicode alphanumeric, dash, underscore, or dot, is removed.
>>> get_valid_filename("john's portrait in 2004.jpg")
'johns_portrait_in_2004.jpg'