From b9f798897060daa039ff3128e7c605125af09a2d Mon Sep 17 00:00:00 2001 From: Irwan Fathurrahman Date: Fri, 20 Oct 2023 09:29:45 +0700 Subject: [PATCH] Fix timezone compare error on osmenrich --- docker-osmenrich/enrich.py | 3 ++- docker-osmenrich/requirements.txt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-osmenrich/enrich.py b/docker-osmenrich/enrich.py index 053e54e..d462226 100644 --- a/docker-osmenrich/enrich.py +++ b/docker-osmenrich/enrich.py @@ -26,6 +26,7 @@ from os.path import join, exists, getsize from sys import exit, stderr from time import sleep from urllib import request +from datetime import timezone import xmltodict import yaml @@ -319,7 +320,7 @@ class Enrich(object): if osm_id and row: allow_updated = False osm_timestamp = self.check_data_on_dict(from_osm, '@timestamp') - osm_datetime = parser.parse(osm_timestamp).replace(tzinfo=None) + osm_datetime = parser.parse(osm_timestamp).replace(tzinfo=timezone.utc) if not row['changeset_timestamp'] or row['changeset_timestamp'] < osm_datetime: allow_updated = True if allow_updated: diff --git a/docker-osmenrich/requirements.txt b/docker-osmenrich/requirements.txt index 3921e25..25bda9d 100644 --- a/docker-osmenrich/requirements.txt +++ b/docker-osmenrich/requirements.txt @@ -1,4 +1,4 @@ -psycopg2-binary==2.9.4 +psycopg2-binary==2.9.9 python-dateutil==2.8.2 -PyYAML==6.0 +PyYAML==6.0.1 xmltodict==0.13.0 \ No newline at end of file