timezone aware publish datetime
also as datetime over just date
This commit is contained in:
parent
5f805f60a8
commit
65586d7859
@ -4,7 +4,7 @@ import json
|
|||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime, timezone
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
@ -55,7 +55,7 @@ class RSSItem:
|
|||||||
description = entry.get('description', None)
|
description = entry.get('description', None)
|
||||||
|
|
||||||
pub_date = entry.get('published_parsed', None)
|
pub_date = entry.get('published_parsed', None)
|
||||||
pub_date = datetime(*pub_date[0:-2] if pub_date else None)
|
pub_date = datetime(*pub_date[0:6], tzinfo=timezone.utc)
|
||||||
|
|
||||||
image_url = entry.get("media_content", [{}])[0].get("url")
|
image_url = entry.get("media_content", [{}])[0].get("url")
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ class Subscription(DjangoDataModel):
|
|||||||
"title": item.pop("article_title_mutators"),
|
"title": item.pop("article_title_mutators"),
|
||||||
"description": item.pop("article_desc_mutators")
|
"description": item.pop("article_desc_mutators")
|
||||||
}
|
}
|
||||||
item["published_threshold"] = datetime.strptime(item["published_threshold"], "%Y-%m-%d")
|
item["published_threshold"] = datetime.strptime(item["published_threshold"], "%Y-%m-%dT%H:%M:%S%z")
|
||||||
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user