import types
import urllib.request as urlrequest
-import requests
-
from ..errors import UsageError
from ..db import status
from ..db.connection import Connection, connect, server_version_tuple
from osmium.replication.server import ReplicationServer
from osmium import WriteHandler
from osmium import version as pyo_version
-except ImportError as exc:
+ import requests
+except ModuleNotFoundError as exc:
logging.getLogger().critical("pyosmium not installed. Replication functions not available.\n"
- "To install pyosmium via pip: pip3 install osmium")
+ "To install pyosmium via pip: pip install osmium")
raise UsageError("replication tools not available") from exc
LOG = logging.getLogger()
# Read updates into file.
with _make_replication_server(options['base_url'], socket_timeout) as repl:
outhandler = WriteHandler(str(options['import_file']))
- endseq = repl.apply_diffs(outhandler, startseq + 1,
+ # tyoing: work around typing bug in pyosmium 4.0
+ endseq = repl.apply_diffs(outhandler, startseq + 1, # type: ignore[arg-type]
max_size=options['max_diff_size'] * 1024)
outhandler.close()