💾 Archived View for tanso.net › diary › 2020-11-17.gmi captured on 2023-07-22 at 17:00:33. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-04-26)
-=-=-=-=-=-=-
Found the gemfeed atom feed tool for Gemini at https://lists.orbitalfox.eu/archives/gemini/2020/000502.html, but it didn't work in my environment:
# ./gemfeed.py -b gemini://tanso.net -d /srv/gemini/files/diary/ Generating feed "diary", which should be served from gemini://tanso.net/atom.xml Traceback (most recent call last): File "./gemfeed.py", line 223, in <module> main() File "./gemfeed.py", line 220, in main args.verbose) File "./gemfeed.py", line 160, in build_feed populate_entry_from_file(filename, base_url, entry, time_func) File "./gemfeed.py", line 97, in populate_entry_from_file updated = get_update_time(filename, time_func) File "./gemfeed.py", line 116, in get_update_time return datetime.datetime.strptime(date, "%Y-%m-%d %z") File "/usr/lib64/python3.6/_strptime.py", line 565, in _strptime_datetime tt, fraction = _strptime(data_string, format) File "/usr/lib64/python3.6/_strptime.py", line 362, in _strptime (data_string, format)) ValueError: time data '2020-11-17 Z' does not match format '%Y-%m-%d %z'
Fixed it by this small change:
diff --git a/gemfeed.py b/gemfeed.py index 93d5886..73ec159 100755 --- a/gemfeed.py +++ b/gemfeed.py @@ -112,8 +112,8 @@ def get_update_time(filename, time_func): # Check for leading YYYY-MM-DD basename = os.path.basename(filename) if re.search("^[0-9]{4}-[01][0-9]-[0-3][0-9]", basename): - date = basename[0:10] + " Z" # Add UTC marker - return datetime.datetime.strptime(date, "%Y-%m-%d %z") + date = basename[0:10] + return datetime.datetime.strptime(, "%Y-%m-%d").replace(tzinfo=datetime.timezone.utc) else: updated = time_func(filename) return datetime.datetime.fromtimestamp(updated, tz=datetime.timezone.utc)
Suggested patch sent to solderpunk.