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. 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) 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],