]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #3521 from lonvia/make-requests-optional
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 20 Aug 2024 07:03:39 +0000 (09:03 +0200)
committerGitHub <noreply@github.com>
Tue, 20 Aug 2024 07:03:39 +0000 (09:03 +0200)
Fix error around missing requests library

src/nominatim_db/tools/replication.py

index 2b1d444f0cb1e3cd08b6540273ac9b64d136e43f..eb031f390221c4dcea846f9d12999995ddb38011 100644 (file)
@@ -16,8 +16,6 @@ import time
 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
@@ -27,9 +25,10 @@ try:
     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()