Fix boto3 S3 upload issue
This commit is contained in:
@@ -63,7 +63,8 @@ def load_latest_statuses(url, token, limit):
|
||||
raise Exception('Failed to contact Mastodon', response.text)
|
||||
return json.loads(response.text)
|
||||
|
||||
def convertToHTML(statuses):
|
||||
|
||||
def convertToHTML(statuses) -> str:
|
||||
css_file = Path(__file__).parent / '../resources/embed.css'
|
||||
with css_file.open('r') as css:
|
||||
doc, tag, text = Doc().tagtext()
|
||||
@@ -96,7 +97,8 @@ def convertToHTML(statuses):
|
||||
|
||||
return indent(doc.getvalue())
|
||||
|
||||
def uploadToAmazonS3(bucket, key, content):
|
||||
def uploadToAmazonS3(bucket, key, content:str):
|
||||
logger.info(f'Uploading embed html to {bucket}/{key}')
|
||||
s3 = boto3.resource('s3')
|
||||
object = s3.Object(bucket, key) # type: ignore
|
||||
object.put(Body=content, ACL='public-read', ContentType='text/html')
|
||||
s3_object = s3.Object(bucket, key)
|
||||
s3_object.put(Body=content.encode("utf-8"), ACL='public-read', ContentType='text/html')
|
||||
Reference in New Issue
Block a user