]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/tools/exec_utils.py
add a function to return a formatted version
[nominatim.git] / nominatim / tools / exec_utils.py
index 10d8fbc08acbf398f5d0a28c799395b1d20b2518..db2a4c2ea05a03c28e5f481ae9cb8923b678a15b 100644 (file)
@@ -12,7 +12,7 @@ import subprocess
 import urllib.request as urlrequest
 from urllib.parse import urlencode
 
-from nominatim.version import NOMINATIM_VERSION
+from nominatim.version import version_str
 from nominatim.db.connection import get_pg_env
 
 LOG = logging.getLogger()
@@ -42,7 +42,7 @@ def run_legacy_script(script, *args, nominatim_env=None, throw_on_fail=False):
 
 def run_api_script(endpoint, project_dir, extra_env=None, phpcgi_bin=None,
                    params=None):
-    """ Execute a Nominiatim API function.
+    """ Execute a Nominatim API function.
 
         The function needs a project directory that contains the website
         directory with the scripts to be executed. The scripts will be run
@@ -150,7 +150,7 @@ def run_osm2pgsql(options):
 def get_url(url):
     """ Get the contents from the given URL and return it as a UTF-8 string.
     """
-    headers = {"User-Agent": "Nominatim/{0[0]}.{0[1]}.{0[2]}-{0[3]}".format(NOMINATIM_VERSION)}
+    headers = {"User-Agent": f"Nominatim/{version_str()}"}
 
     try:
         with urlrequest.urlopen(urlrequest.Request(url, headers=headers)) as response: