Browse Source

trying to get around the pytz timezone warning The zone attribute is specific to pytz's interface; please migrate to a new time zone provider. For more details on how to do so, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html

master
manetta 3 years ago
parent
commit
9accbf4456
  1. 8
      feedtools.py
  2. 3
      requirements.txt

8
feedtools.py

@ -1,7 +1,8 @@
import feedparser
from simpledatabase import SimpleDatabase
import json
from datetime import date, timedelta
from datetime import datetime, date, timedelta
from backports.zoneinfo import ZoneInfo
def update():
""" Update all feeds """
@ -14,6 +15,7 @@ def update():
for x, feed in enumerate(feeds):
parsed = feedparser.parse(feed)
# print(parsed)
x = str(x)
tmp['feeds'][x] = {}
@ -26,7 +28,7 @@ def update():
year = post['published_parsed'][0]
month = post['published_parsed'][1]
day = post['published_parsed'][2]
post_date = date(year, month, day)
post_date = datetime(year, month, day, tzinfo=ZoneInfo("Europe/Amsterdam"))
if not str(post_date) in tmp['all_posts_sorted']:
tmp['all_posts_sorted'][str(post_date)] = []
@ -82,7 +84,7 @@ def today():
return request
def past(days):
""" Collect posts from this week """
""" Collect posts from a number of past <days> """
db = load()
point_in_the_past = date.today() - timedelta(int(days))
request = []

3
requirements.txt

@ -1,4 +1,5 @@
flask
feedparser
pathlib
Flask-APScheduler
Flask-APScheduler
backports.zoneinfo
Loading…
Cancel
Save