From ea7ee5d4b3f3a381c36d4793036f5830360fdc7a Mon Sep 17 00:00:00 2001 From: Chirag Jain Date: Wed, 26 Nov 2025 17:29:12 +0530 Subject: [PATCH 1/2] Set published_date --- blog/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/blog/main.py b/blog/main.py index 90c59230..e5fb00da 100644 --- a/blog/main.py +++ b/blog/main.py @@ -6,7 +6,7 @@ from urllib.parse import urljoin from helpers import Item, ItemType, StrapiBlog from tqdm.auto import tqdm -from datetime import datetime +from datetime import datetime, timezone from pathlib import Path args = None @@ -141,6 +141,7 @@ def upload_blog(blog: StrapiBlog): blog_id = existing[0]["documentId"] blog.set_slug_url(existing[0].get("slug_url")) blog.set_published_at(existing[0].get("publishedAt")) + print(existing[0].get("publishedAt")) meta_desc = existing[0].get("meta_desc") if meta_desc: blog.meta_desc = meta_desc @@ -154,6 +155,11 @@ def upload_blog(blog: StrapiBlog): else: # New blog blog.meta_desc = blog.title + blog.set_published_at( + datetime.now(timezone.utc) + .isoformat(timespec="milliseconds") + .replace("+00:00", "Z") + ) create_response = session.post( base_url, headers=headers, data=json.dumps(blog.get_post_json()) ) From f026115547fd541e67935995d25e6befbc625686 Mon Sep 17 00:00:00 2001 From: Chirag Jain Date: Wed, 26 Nov 2025 17:31:04 +0530 Subject: [PATCH 2/2] minor changes --- blog/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/blog/main.py b/blog/main.py index e5fb00da..bbbbbb1e 100644 --- a/blog/main.py +++ b/blog/main.py @@ -141,7 +141,6 @@ def upload_blog(blog: StrapiBlog): blog_id = existing[0]["documentId"] blog.set_slug_url(existing[0].get("slug_url")) blog.set_published_at(existing[0].get("publishedAt")) - print(existing[0].get("publishedAt")) meta_desc = existing[0].get("meta_desc") if meta_desc: blog.meta_desc = meta_desc