From 919ced8e139abca5cf053b8f53e366a11da46dd9 Mon Sep 17 00:00:00 2001 From: ruanqizhen Date: Fri, 22 Mar 2024 17:20:30 -0400 Subject: [PATCH 1/3] Update osmchange.py --- src/osmdiff/osmchange.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osmdiff/osmchange.py b/src/osmdiff/osmchange.py index 54e32e9..d6c2783 100644 --- a/src/osmdiff/osmchange.py +++ b/src/osmdiff/osmchange.py @@ -1,4 +1,4 @@ -import os +from posixpath import join as urljoin from gzip import GzipFile from xml.etree import ElementTree @@ -32,7 +32,7 @@ def __init__( def get_state(self): """Get the current state from the OSM API""" - state_url = os.path.join(self.base_url, self._frequency, "state.txt") + state_url = urljoin(self.base_url, self._frequency, "state.txt") response = requests.get(state_url, timeout=5) if response.status_code != 200: return False @@ -45,7 +45,7 @@ def get_state(self): def _build_sequence_url(self): seqno = str(self._sequence_number).zfill(9) - url = os.path.join( + url = urljoin( self.base_url, self._frequency, seqno[:3], From 82af217523c2ad501e6b0c138e4ca0054bfa253a Mon Sep 17 00:00:00 2001 From: ruanqizhen Date: Fri, 22 Mar 2024 17:21:26 -0400 Subject: [PATCH 2/3] Update augmenteddiff.py --- src/osmdiff/augmenteddiff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osmdiff/augmenteddiff.py b/src/osmdiff/augmenteddiff.py index efa348d..43fbe8f 100644 --- a/src/osmdiff/augmenteddiff.py +++ b/src/osmdiff/augmenteddiff.py @@ -1,4 +1,4 @@ -import os +from posixpath import join as urljoin from xml.etree import cElementTree import dateutil.parser @@ -49,7 +49,7 @@ def __init__( def get_state(self): """Get the current state from the OSM API""" - state_url = os.path.join(self.base_url, "augmented_diff_status") + state_url = urljoin(self.base_url, "augmented_diff_status") if self.debug: print("getting state from", state_url) response = requests.get(state_url, timeout=5) From 7336b0fa3eace2b6650e1e2d04ec64ac2e8d9689 Mon Sep 17 00:00:00 2001 From: ruanqizhen Date: Wed, 27 Mar 2024 16:35:45 -0400 Subject: [PATCH 3/3] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 82c8b36..01fdce1 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,7 @@ Retrieve the latest replication diff from the OSM API: ```python >>> from osmdiff import OSMChange ->>> o = OSMChange() ->>> o.frequency = "minute" # the default +>>> o = OSMChange(frequency="minute") # minute is the default frequency >>> o.get_state() # retrieve current sequence ID >>> o.sequence_number 2704451 @@ -104,4 +103,4 @@ I welcome your contributions in code, documentation and suggestions for enhancem [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -If you find `osmdiff` useful, or you use it in commercial software, please consider sponsoring this project. \ No newline at end of file +If you find `osmdiff` useful, or you use it in commercial software, please consider sponsoring this project.