Fixing metadata for s3

This commit is contained in:
Charles-Gormley
2024-11-13 18:45:05 -05:00
parent 3ef61aef06
commit f400c8bda5
2 changed files with 16 additions and 3 deletions

View File

@@ -62,8 +62,21 @@ def s3_save_article(article:dict):
json.dump(article, f)
try:
s3.upload_file(file_path, CONTENT_BUCKET, file_key)
s3.upload_file(file_path,
CONTENT_BUCKET,
file_key,
ExtraArgs={
"Metadata":
{
"rss": article.get("rss", ""),
"title": article.get("title", ""),
"unixTime": str(article.get("unixTime", "")),
"article_id": article.get("article_id", ""),
"link": article.get("link", ""),
"rss_id": article.get("rss_id", "")
}
}
)
logger.info(f"Saved article {article_id} to S3 bucket {CONTENT_BUCKET}")
except Exception as e:

View File

@@ -1,6 +1,6 @@
# Before Public Launch
* Rethink Partitioning Strategy [Done]
* Implement New Partitioning Strategy. [Next]
* Implement New Partitioning Strategy. [Done]
- Incorporate: All the json data except for content and link.
Partitioning Strategy: {Year}/{Month}/{Day}/{article_id}
* API Tool - to Pull data that you have down.