search-api-webui 0.1.2__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {search_api_webui-0.1.2 → search_api_webui-0.1.4}/LICENSE +1 -1
- {search_api_webui-0.1.2 → search_api_webui-0.1.4}/PKG-INFO +18 -16
- {search_api_webui-0.1.2 → search_api_webui-0.1.4}/README.md +17 -15
- {search_api_webui-0.1.2 → search_api_webui-0.1.4}/pyproject.toml +5 -8
- search_api_webui-0.1.4/search_api_webui/__init__.py +20 -0
- {search_api_webui-0.1.2/backend → search_api_webui-0.1.4/search_api_webui}/app.py +33 -4
- search_api_webui-0.1.4/search_api_webui/providers/__init__.py +54 -0
- search_api_webui-0.1.4/search_api_webui/providers/base.py +45 -0
- {search_api_webui-0.1.2/backend → search_api_webui-0.1.4/search_api_webui}/providers/generic.py +20 -0
- {search_api_webui-0.1.2/backend → search_api_webui-0.1.4/search_api_webui}/providers/querit.py +20 -0
- search_api_webui-0.1.2/backend/__init__.py +0 -0
- search_api_webui-0.1.2/backend/providers/__init__.py +0 -34
- search_api_webui-0.1.2/backend/providers/base.py +0 -25
- search_api_webui-0.1.2/backend/static/assets/index-CF13bI2g.js +0 -181
- search_api_webui-0.1.2/backend/static/assets/index-DLyBd1PD.css +0 -1
- search_api_webui-0.1.2/backend/static/index.html +0 -13
- {search_api_webui-0.1.2 → search_api_webui-0.1.4}/.gitignore +0 -0
- {search_api_webui-0.1.2 → search_api_webui-0.1.4/search_api_webui}/providers.yaml +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2026
|
|
1
|
+
Copyright (c) 2026 QUERIT PRIVATE LIMITED
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: search-api-webui
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: A Search API WebUI for Querit, You, and other search providers.
|
|
5
5
|
Project-URL: Homepage, https://github.com/querit-ai/search-api-webui
|
|
6
6
|
Project-URL: Repository, https://github.com/querit-ai/search-api-webui.git
|
|
@@ -24,17 +24,17 @@ Description-Content-Type: text/markdown
|
|
|
24
24
|
|
|
25
25
|
# Search API WebUI
|
|
26
26
|
|
|
27
|
-
A lightweight, local WebUI for testing and visualizing Search APIs (Querit,
|
|
27
|
+
A lightweight, local WebUI for testing and visualizing Search APIs (Querit, You, etc.).
|
|
28
28
|
|
|
29
29
|
(images)
|
|
30
30
|
|
|
31
31
|
## Features
|
|
32
32
|
|
|
33
|
-
**Search**: Support for Querit, You.com, and generic Search APIs via configuration.
|
|
34
|
-
**Performance Metrics**: Real-time display of request latency and payload size.
|
|
35
|
-
**Visual Rendering**: Renders standard search results (Title, Snippet, URL) in a clean card layout.
|
|
36
|
-
**Configurable**: Easy-to-edit providers.yaml to add or modify search providers.
|
|
37
|
-
**Secure**: API Keys are stored locally in
|
|
33
|
+
* **Search**: Support for [Querit.ai](https://www.querit.ai/en/docs/reference/post), [You.com](https://docs.you.com/api-reference/search/v1-search), and generic Search APIs via configuration.
|
|
34
|
+
* **Performance Metrics**: Real-time display of request latency and payload size.
|
|
35
|
+
* **Visual Rendering**: Renders standard search results (Title, Snippet, URL) in a clean card layout.
|
|
36
|
+
* **Configurable**: Easy-to-edit providers.yaml to add or modify search providers.
|
|
37
|
+
* **Secure**: API Keys are stored locally in your $HOME folder.
|
|
38
38
|
## Installation
|
|
39
39
|
|
|
40
40
|
Use this method if you just want to run the tool without modifying the code.
|
|
@@ -54,25 +54,26 @@ pip install search-api-webui
|
|
|
54
54
|
search-api-webui
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Open your browser at http://localhost:8889.
|
|
58
|
-
|
|
59
57
|
## Development
|
|
60
58
|
|
|
61
59
|
Use this method if you want to contribute to the code or build from source.
|
|
62
60
|
|
|
63
61
|
### Prerequisites
|
|
64
62
|
|
|
65
|
-
Python 3.7+
|
|
66
|
-
Node.js & npm (for building the frontend)
|
|
63
|
+
* Python 3.7+
|
|
64
|
+
* Node.js & npm (for building the frontend)
|
|
65
|
+
|
|
67
66
|
### Setup Steps
|
|
68
67
|
|
|
69
68
|
**Clone the repository**
|
|
69
|
+
|
|
70
70
|
```
|
|
71
71
|
git clone https://github.com/querit-ai/search-api-webui.git
|
|
72
72
|
cd search-api-webui
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
**Build Frontend**
|
|
76
|
+
|
|
76
77
|
```
|
|
77
78
|
cd frontend
|
|
78
79
|
npm install
|
|
@@ -80,23 +81,24 @@ npm run build
|
|
|
80
81
|
cd …
|
|
81
82
|
```
|
|
82
83
|
|
|
83
|
-
**Install
|
|
84
|
+
**Install search-api-webui (Editable Mode)**
|
|
85
|
+
|
|
84
86
|
```
|
|
85
87
|
pip install -e .
|
|
86
88
|
```
|
|
87
89
|
|
|
88
90
|
**Run the Server**
|
|
91
|
+
|
|
89
92
|
```
|
|
90
|
-
python -m
|
|
93
|
+
python -m search_api_webui.app
|
|
91
94
|
```
|
|
92
95
|
|
|
93
96
|
## Configuration
|
|
94
97
|
|
|
95
98
|
### Add API Keys
|
|
96
99
|
|
|
97
|
-
Open the WebUI settings page (click the gear icon).
|
|
98
|
-
|
|
99
|
-
Keys are saved locally in user_config.json.
|
|
100
|
+
Open the WebUI settings page (click the gear icon). Enter your API Key for the selected provider (e.g., Querit). Keys are saved locally in $HOME/.search-api-webui/config.json.
|
|
101
|
+
|
|
100
102
|
### Add New Providers
|
|
101
103
|
|
|
102
104
|
Edit providers.yaml in the root directory to add custom API endpoints. The system uses JMESPath to map JSON responses to the UI.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Search API WebUI
|
|
2
2
|
|
|
3
|
-
A lightweight, local WebUI for testing and visualizing Search APIs (Querit,
|
|
3
|
+
A lightweight, local WebUI for testing and visualizing Search APIs (Querit, You, etc.).
|
|
4
4
|
|
|
5
5
|
(images)
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
**Search**: Support for Querit, You.com, and generic Search APIs via configuration.
|
|
10
|
-
**Performance Metrics**: Real-time display of request latency and payload size.
|
|
11
|
-
**Visual Rendering**: Renders standard search results (Title, Snippet, URL) in a clean card layout.
|
|
12
|
-
**Configurable**: Easy-to-edit providers.yaml to add or modify search providers.
|
|
13
|
-
**Secure**: API Keys are stored locally in
|
|
9
|
+
* **Search**: Support for [Querit.ai](https://www.querit.ai/en/docs/reference/post), [You.com](https://docs.you.com/api-reference/search/v1-search), and generic Search APIs via configuration.
|
|
10
|
+
* **Performance Metrics**: Real-time display of request latency and payload size.
|
|
11
|
+
* **Visual Rendering**: Renders standard search results (Title, Snippet, URL) in a clean card layout.
|
|
12
|
+
* **Configurable**: Easy-to-edit providers.yaml to add or modify search providers.
|
|
13
|
+
* **Secure**: API Keys are stored locally in your $HOME folder.
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
16
|
Use this method if you just want to run the tool without modifying the code.
|
|
@@ -30,25 +30,26 @@ pip install search-api-webui
|
|
|
30
30
|
search-api-webui
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Open your browser at http://localhost:8889.
|
|
34
|
-
|
|
35
33
|
## Development
|
|
36
34
|
|
|
37
35
|
Use this method if you want to contribute to the code or build from source.
|
|
38
36
|
|
|
39
37
|
### Prerequisites
|
|
40
38
|
|
|
41
|
-
Python 3.7+
|
|
42
|
-
Node.js & npm (for building the frontend)
|
|
39
|
+
* Python 3.7+
|
|
40
|
+
* Node.js & npm (for building the frontend)
|
|
41
|
+
|
|
43
42
|
### Setup Steps
|
|
44
43
|
|
|
45
44
|
**Clone the repository**
|
|
45
|
+
|
|
46
46
|
```
|
|
47
47
|
git clone https://github.com/querit-ai/search-api-webui.git
|
|
48
48
|
cd search-api-webui
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
**Build Frontend**
|
|
52
|
+
|
|
52
53
|
```
|
|
53
54
|
cd frontend
|
|
54
55
|
npm install
|
|
@@ -56,23 +57,24 @@ npm run build
|
|
|
56
57
|
cd …
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
**Install
|
|
60
|
+
**Install search-api-webui (Editable Mode)**
|
|
61
|
+
|
|
60
62
|
```
|
|
61
63
|
pip install -e .
|
|
62
64
|
```
|
|
63
65
|
|
|
64
66
|
**Run the Server**
|
|
67
|
+
|
|
65
68
|
```
|
|
66
|
-
python -m
|
|
69
|
+
python -m search_api_webui.app
|
|
67
70
|
```
|
|
68
71
|
|
|
69
72
|
## Configuration
|
|
70
73
|
|
|
71
74
|
### Add API Keys
|
|
72
75
|
|
|
73
|
-
Open the WebUI settings page (click the gear icon).
|
|
74
|
-
|
|
75
|
-
Keys are saved locally in user_config.json.
|
|
76
|
+
Open the WebUI settings page (click the gear icon). Enter your API Key for the selected provider (e.g., Querit). Keys are saved locally in $HOME/.search-api-webui/config.json.
|
|
77
|
+
|
|
76
78
|
### Add New Providers
|
|
77
79
|
|
|
78
80
|
Edit providers.yaml in the root directory to add custom API endpoints. The system uses JMESPath to map JSON responses to the UI.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "search-api-webui"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.4"
|
|
8
8
|
description = "A Search API WebUI for Querit, You, and other search providers."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.7"
|
|
@@ -35,19 +35,17 @@ Repository = "https://github.com/querit-ai/search-api-webui.git"
|
|
|
35
35
|
Issues = "https://github.com/querit-ai/search-api-webui/issues"
|
|
36
36
|
|
|
37
37
|
[project.scripts]
|
|
38
|
-
search-api-webui = "
|
|
38
|
+
search-api-webui = "search_api_webui.app:main"
|
|
39
39
|
|
|
40
40
|
[tool.hatch.build.targets.wheel]
|
|
41
|
-
packages = ["
|
|
41
|
+
packages = ["search_api_webui"]
|
|
42
42
|
|
|
43
43
|
[tool.hatch.build.targets.sdist]
|
|
44
44
|
include = [
|
|
45
|
-
"
|
|
46
|
-
"providers.yaml",
|
|
45
|
+
"search_api_webui",
|
|
47
46
|
"README.md",
|
|
48
47
|
"LICENSE"
|
|
49
48
|
]
|
|
50
|
-
artifacts = ["backend/static"]
|
|
51
49
|
exclude = [
|
|
52
50
|
"frontend",
|
|
53
51
|
"user_config.json",
|
|
@@ -55,5 +53,4 @@ exclude = [
|
|
|
55
53
|
]
|
|
56
54
|
|
|
57
55
|
[tool.hatch.build.targets.wheel.force-include]
|
|
58
|
-
"
|
|
59
|
-
"providers.yaml" = "backend/providers.yaml"
|
|
56
|
+
"frontend/dist" = "search_api_webui/static"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright (c) 2026 QUERIT PRIVATE LIMITED
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to
|
|
5
|
+
# deal in the Software without restriction, including without limitation the
|
|
6
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
16
|
+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
19
|
+
# DEALINGS IN THE SOFTWARE.
|
|
20
|
+
|
|
@@ -1,12 +1,38 @@
|
|
|
1
|
+
# Copyright (c) 2026 QUERIT PRIVATE LIMITED
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to
|
|
5
|
+
# deal in the Software without restriction, including without limitation the
|
|
6
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
16
|
+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
19
|
+
# DEALINGS IN THE SOFTWARE.
|
|
20
|
+
|
|
1
21
|
import json
|
|
2
22
|
import os
|
|
23
|
+
import webbrowser
|
|
3
24
|
from pathlib import Path
|
|
4
25
|
from flask import Flask, request, jsonify, send_from_directory
|
|
5
26
|
from flask_cors import CORS
|
|
6
|
-
from
|
|
27
|
+
from search_api_webui.providers import load_providers
|
|
7
28
|
|
|
8
29
|
CURRENT_DIR = Path(__file__).resolve().parent
|
|
30
|
+
|
|
9
31
|
STATIC_FOLDER = CURRENT_DIR / 'static'
|
|
32
|
+
if not STATIC_FOLDER.exists():
|
|
33
|
+
DEV_FRONTEND_DIST = CURRENT_DIR.parent / 'frontend' / 'dist'
|
|
34
|
+
if DEV_FRONTEND_DIST.exists():
|
|
35
|
+
STATIC_FOLDER = DEV_FRONTEND_DIST
|
|
10
36
|
|
|
11
37
|
app = Flask(__name__, static_folder='static')
|
|
12
38
|
CORS(app)
|
|
@@ -151,15 +177,18 @@ def main():
|
|
|
151
177
|
import argparse
|
|
152
178
|
parser = argparse.ArgumentParser(description="Search API WebUI")
|
|
153
179
|
parser.add_argument("--port", type=int, default=8889, help="Port to run the server on")
|
|
154
|
-
parser.add_argument("--host", type=str, default="
|
|
180
|
+
parser.add_argument("--host", type=str, default="127.0.0.1", help="Host to run the server on")
|
|
155
181
|
args = parser.parse_args()
|
|
156
182
|
|
|
183
|
+
url = f"http://{args.host}:{args.port}"
|
|
157
184
|
print(f"Starting Search API WebUI...")
|
|
158
185
|
print(f" - Config Storage: {USER_CONFIG_JSON}")
|
|
159
|
-
print(f" - Serving on:
|
|
186
|
+
print(f" - Serving on: {url}")
|
|
187
|
+
|
|
188
|
+
# Open browser automatically after a short delay to ensure server is ready
|
|
189
|
+
webbrowser.open(url)
|
|
160
190
|
|
|
161
191
|
app.run(host=args.host, port=args.port)
|
|
162
192
|
|
|
163
193
|
if __name__ == "__main__":
|
|
164
194
|
main()
|
|
165
|
-
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Copyright (c) 2026 QUERIT PRIVATE LIMITED
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to
|
|
5
|
+
# deal in the Software without restriction, including without limitation the
|
|
6
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
16
|
+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
19
|
+
# DEALINGS IN THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
import os
|
|
22
|
+
import yaml
|
|
23
|
+
from .generic import GenericProvider
|
|
24
|
+
from .querit import QueritSdkProvider
|
|
25
|
+
|
|
26
|
+
def load_providers(file_path='providers.yaml'):
|
|
27
|
+
"""
|
|
28
|
+
Parses the YAML configuration file and instantiates the appropriate provider classes.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
file_path (str): Path to the providers configuration file.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
dict: A dictionary mapping provider names to their initialized instances.
|
|
35
|
+
"""
|
|
36
|
+
if not os.path.exists(file_path):
|
|
37
|
+
print(f"Warning: Provider config file not found at {file_path}")
|
|
38
|
+
return {}
|
|
39
|
+
|
|
40
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
41
|
+
configs = yaml.safe_load(f)
|
|
42
|
+
|
|
43
|
+
providers = {}
|
|
44
|
+
for name, conf in configs.items():
|
|
45
|
+
conf['name'] = name
|
|
46
|
+
provider_type = conf.get('type', 'generic')
|
|
47
|
+
|
|
48
|
+
# Instantiate specific provider based on type or name
|
|
49
|
+
if provider_type == 'querit_sdk':
|
|
50
|
+
providers[name] = QueritSdkProvider(conf)
|
|
51
|
+
else:
|
|
52
|
+
providers[name] = GenericProvider(conf)
|
|
53
|
+
|
|
54
|
+
return providers
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Copyright (c) 2026 QUERIT PRIVATE LIMITED
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to
|
|
5
|
+
# deal in the Software without restriction, including without limitation the
|
|
6
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
16
|
+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
19
|
+
# DEALINGS IN THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
from abc import ABC, abstractmethod
|
|
22
|
+
|
|
23
|
+
class BaseProvider(ABC):
|
|
24
|
+
"""
|
|
25
|
+
Abstract base class for all search providers.
|
|
26
|
+
Enforces a standard interface for executing search queries.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
@abstractmethod
|
|
30
|
+
def search(self, query, api_key, **kwargs):
|
|
31
|
+
"""
|
|
32
|
+
Execute a search request against the provider.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
query (str): The search keywords.
|
|
36
|
+
api_key (str): The API Key required for authentication.
|
|
37
|
+
**kwargs: Arbitrary keyword arguments (e.g., 'limit', 'language', 'api_url').
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
dict: A standardized dictionary containing:
|
|
41
|
+
- 'results': List of dicts with 'title', 'url', 'snippet'.
|
|
42
|
+
- 'metrics': Dict with 'latency_ms' and 'size_bytes'.
|
|
43
|
+
- 'error': (Optional) Error message string if occurred.
|
|
44
|
+
"""
|
|
45
|
+
pass
|
{search_api_webui-0.1.2/backend → search_api_webui-0.1.4/search_api_webui}/providers/generic.py
RENAMED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# Copyright (c) 2026 QUERIT PRIVATE LIMITED
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to
|
|
5
|
+
# deal in the Software without restriction, including without limitation the
|
|
6
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
16
|
+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
19
|
+
# DEALINGS IN THE SOFTWARE.
|
|
20
|
+
|
|
1
21
|
import time
|
|
2
22
|
import requests
|
|
3
23
|
import jmespath
|
{search_api_webui-0.1.2/backend → search_api_webui-0.1.4/search_api_webui}/providers/querit.py
RENAMED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# Copyright (c) 2026 QUERIT PRIVATE LIMITED
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to
|
|
5
|
+
# deal in the Software without restriction, including without limitation the
|
|
6
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
16
|
+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
19
|
+
# DEALINGS IN THE SOFTWARE.
|
|
20
|
+
|
|
1
21
|
import time
|
|
2
22
|
import json
|
|
3
23
|
from querit import QueritClient
|
|
File without changes
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import yaml
|
|
3
|
-
from .generic import GenericProvider
|
|
4
|
-
from .querit import QueritSdkProvider
|
|
5
|
-
|
|
6
|
-
def load_providers(file_path='providers.yaml'):
|
|
7
|
-
"""
|
|
8
|
-
Parses the YAML configuration file and instantiates the appropriate provider classes.
|
|
9
|
-
|
|
10
|
-
Args:
|
|
11
|
-
file_path (str): Path to the providers configuration file.
|
|
12
|
-
|
|
13
|
-
Returns:
|
|
14
|
-
dict: A dictionary mapping provider names to their initialized instances.
|
|
15
|
-
"""
|
|
16
|
-
if not os.path.exists(file_path):
|
|
17
|
-
print(f"Warning: Provider config file not found at {file_path}")
|
|
18
|
-
return {}
|
|
19
|
-
|
|
20
|
-
with open(file_path, 'r', encoding='utf-8') as f:
|
|
21
|
-
configs = yaml.safe_load(f)
|
|
22
|
-
|
|
23
|
-
providers = {}
|
|
24
|
-
for name, conf in configs.items():
|
|
25
|
-
conf['name'] = name
|
|
26
|
-
provider_type = conf.get('type', 'generic')
|
|
27
|
-
|
|
28
|
-
# Instantiate specific provider based on type or name
|
|
29
|
-
if provider_type == 'querit_sdk':
|
|
30
|
-
providers[name] = QueritSdkProvider(conf)
|
|
31
|
-
else:
|
|
32
|
-
providers[name] = GenericProvider(conf)
|
|
33
|
-
|
|
34
|
-
return providers
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
|
|
3
|
-
class BaseProvider(ABC):
|
|
4
|
-
"""
|
|
5
|
-
Abstract base class for all search providers.
|
|
6
|
-
Enforces a standard interface for executing search queries.
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
@abstractmethod
|
|
10
|
-
def search(self, query, api_key, **kwargs):
|
|
11
|
-
"""
|
|
12
|
-
Execute a search request against the provider.
|
|
13
|
-
|
|
14
|
-
Args:
|
|
15
|
-
query (str): The search keywords.
|
|
16
|
-
api_key (str): The API Key required for authentication.
|
|
17
|
-
**kwargs: Arbitrary keyword arguments (e.g., 'limit', 'language', 'api_url').
|
|
18
|
-
|
|
19
|
-
Returns:
|
|
20
|
-
dict: A standardized dictionary containing:
|
|
21
|
-
- 'results': List of dicts with 'title', 'url', 'snippet'.
|
|
22
|
-
- 'metrics': Dict with 'latency_ms' and 'size_bytes'.
|
|
23
|
-
- 'error': (Optional) Error message string if occurred.
|
|
24
|
-
"""
|
|
25
|
-
pass
|