]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #2869 from mtmail/improve-tiger-install-doc
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 9 Nov 2022 19:48:39 +0000 (20:48 +0100)
committerGitHub <noreply@github.com>
Wed, 9 Nov 2022 19:48:39 +0000 (20:48 +0100)
Tiger install doc: add -refresh website- step

nominatim/tools/replication.py

index d93335b8b7169bcf9746970f4919c0db76066917..443a957729bd938d22e885cea2b1ac2fdfbd45f9 100644 (file)
@@ -156,25 +156,25 @@ def _make_replication_server(url: str, timeout: int) -> ContextManager[Replicati
             """ Download a resource from the given URL and return a byte sequence
                 of the content.
             """
-            get_params = {
-                'headers': {"User-Agent" : f"Nominatim (pyosmium/{pyo_version.pyosmium_release})"},
-                'timeout': timeout or None,
-                'stream': True
-            }
+            headers = {"User-Agent" : f"Nominatim (pyosmium/{pyo_version.pyosmium_release})"}
 
             if self.session is not None:
-                return self.session.get(url.get_full_url(), **get_params)
+                return self.session.get(url.get_full_url(),
+                                       headers=headers, timeout=timeout or None,
+                                       stream=True)
 
             @contextmanager
             def _get_url_with_session() -> Iterator[requests.Response]:
                 with requests.Session() as session:
-                    request = session.get(url.get_full_url(), **get_params) # type: ignore
+                    request = session.get(url.get_full_url(),
+                                          headers=headers, timeout=timeout or None,
+                                          stream=True)
                     yield request
 
             return _get_url_with_session()
 
         repl = ReplicationServer(url)
-        repl.open_url = types.MethodType(patched_open_url, repl)
+        setattr(repl, 'open_url', types.MethodType(patched_open_url, repl))
 
         return cast(ContextManager[ReplicationServer], repl)