]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/bdd/steps/steps_api_queries.py
Merge pull request #2970 from lonvia/add-details-endpoint
[nominatim.git] / test / bdd / steps / steps_api_queries.py
index 22517338bab04f664198222680f273ae358882a1..1df1d523375665c7b1d1274b22c19610c8f7d09d 100644 (file)
@@ -9,10 +9,12 @@
     Queries may either be run directly via PHP using the query script
     or via the HTTP interface using php-cgi.
 """
+from pathlib import Path
 import json
 import os
 import re
 import logging
+import asyncio
 from urllib.parse import urlencode
 
 from utils import run_script
@@ -72,6 +74,17 @@ def send_api_query(endpoint, params, fmt, context):
             for h in context.table.headings:
                 params[h] = context.table[0][h]
 
+    if context.nominatim.api_engine is None:
+        return send_api_query_php(endpoint, params, context)
+
+    return asyncio.run(context.nominatim.api_engine(endpoint, params,
+                                                    Path(context.nominatim.website_dir.name),
+                                                    context.nominatim.test_env,
+                                                    getattr(context, 'http_headers', {})))
+
+
+
+def send_api_query_php(endpoint, params, context):
     env = dict(BASE_SERVER_ENV)
     env['QUERY_STRING'] = urlencode(params)