webscout 7.8__py3-none-any.whl → 7.9__py3-none-any.whl

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.

Potentially problematic release.


This version of webscout might be problematic. Click here for more details.

Files changed (41) hide show
  1. webscout/Bard.py +5 -25
  2. webscout/DWEBS.py +476 -476
  3. webscout/Extra/__init__.py +2 -0
  4. webscout/Extra/autocoder/__init__.py +1 -1
  5. webscout/Extra/autocoder/{rawdog.py → autocoder.py} +849 -849
  6. webscout/Extra/tempmail/__init__.py +26 -0
  7. webscout/Extra/tempmail/async_utils.py +141 -0
  8. webscout/Extra/tempmail/base.py +156 -0
  9. webscout/Extra/tempmail/cli.py +187 -0
  10. webscout/Extra/tempmail/mail_tm.py +361 -0
  11. webscout/Extra/tempmail/temp_mail_io.py +292 -0
  12. webscout/Provider/Deepinfra.py +288 -286
  13. webscout/Provider/ElectronHub.py +709 -716
  14. webscout/Provider/ExaChat.py +20 -5
  15. webscout/Provider/Gemini.py +167 -165
  16. webscout/Provider/Groq.py +38 -24
  17. webscout/Provider/LambdaChat.py +2 -1
  18. webscout/Provider/TextPollinationsAI.py +232 -230
  19. webscout/Provider/__init__.py +0 -4
  20. webscout/Provider/copilot.py +427 -427
  21. webscout/Provider/freeaichat.py +8 -1
  22. webscout/Provider/uncovr.py +312 -299
  23. webscout/Provider/yep.py +64 -12
  24. webscout/__init__.py +38 -36
  25. webscout/cli.py +293 -293
  26. webscout/conversation.py +350 -17
  27. webscout/litprinter/__init__.py +59 -667
  28. webscout/optimizers.py +419 -419
  29. webscout/update_checker.py +14 -12
  30. webscout/version.py +1 -1
  31. webscout/webscout_search.py +1282 -1282
  32. webscout/webscout_search_async.py +813 -813
  33. {webscout-7.8.dist-info → webscout-7.9.dist-info}/METADATA +44 -39
  34. {webscout-7.8.dist-info → webscout-7.9.dist-info}/RECORD +38 -35
  35. webscout/Provider/DARKAI.py +0 -225
  36. webscout/Provider/EDITEE.py +0 -192
  37. webscout/litprinter/colors.py +0 -54
  38. {webscout-7.8.dist-info → webscout-7.9.dist-info}/LICENSE.md +0 -0
  39. {webscout-7.8.dist-info → webscout-7.9.dist-info}/WHEEL +0 -0
  40. {webscout-7.8.dist-info → webscout-7.9.dist-info}/entry_points.txt +0 -0
  41. {webscout-7.8.dist-info → webscout-7.9.dist-info}/top_level.txt +0 -0
webscout/cli.py CHANGED
@@ -1,293 +1,293 @@
1
- import sys
2
- from .swiftcli import CLI, option
3
- from .webscout_search import WEBS
4
- from .version import __version__
5
-
6
-
7
- def _print_data(data):
8
- """Prints data in a simple formatted way."""
9
- if data:
10
- for i, e in enumerate(data, start=1):
11
- print(f"\nResult {i}:")
12
- print("-" * 50)
13
- for k, v in e.items():
14
- if v:
15
- k = "language" if k == "detected_language" else k
16
- print(f"{k:15}: {v}")
17
- print("-" * 50)
18
-
19
- def _print_weather(data):
20
- """Prints weather data in a clean format."""
21
- current = data["current"]
22
-
23
- print(f"\nCurrent Weather in {data['location']}:")
24
- print("-" * 50)
25
- print(f"Temperature: {current['temperature_c']}°C")
26
- print(f"Feels Like: {current['feels_like_c']}°C")
27
- print(f"Humidity: {current['humidity']}%")
28
- print(f"Wind: {current['wind_speed_ms']} m/s")
29
- print(f"Direction: {current['wind_direction']}°")
30
- print("-" * 50)
31
-
32
- print("\n5-Day Forecast:")
33
- print("-" * 50)
34
- print(f"{'Date':10} {'Condition':15} {'High':8} {'Low':8}")
35
- print("-" * 50)
36
-
37
- for day in data["daily_forecast"][:5]:
38
- print(f"{day['date']:10} {day['condition']:15} {day['max_temp_c']:8.1f}°C {day['min_temp_c']:8.1f}°C")
39
- print("-" * 50)
40
-
41
- # Initialize CLI app
42
- app = CLI(name="webscout", help="Search the web with a simple UI", version=__version__)
43
-
44
- @app.command()
45
- def version():
46
- """Show the version of webscout."""
47
- print(f"webscout version: {__version__}")
48
-
49
- @app.command()
50
- @option("--proxy", help="Proxy URL to use for requests")
51
- @option("--model", "-m", help="AI model to use", default="gpt-4o-mini", type=str)
52
- @option("--timeout", "-t", help="Timeout value for requests", type=int, default=10)
53
- def chat(proxy: str = None, model: str = "gpt-4o-mini", timeout: int = 10):
54
- """Interactive AI chat using DuckDuckGo's AI."""
55
- webs = WEBS(proxy=proxy, timeout=timeout)
56
-
57
- print(f"Using model: {model}")
58
- print("Type your message and press Enter. Press Ctrl+C or type 'exit' to quit.\n")
59
-
60
- try:
61
- while True:
62
- try:
63
- user_input = input(">>> ").strip()
64
- if not user_input or user_input.lower() in ['exit', 'quit']:
65
- break
66
-
67
- response = webs.chat(keywords=user_input, model=model)
68
- print(f"\nAI: {response}\n")
69
-
70
- except Exception as e:
71
- print(f"Error: {str(e)}\n")
72
-
73
- except KeyboardInterrupt:
74
- print("\nChat session interrupted. Exiting...")
75
-
76
- @app.command()
77
- @option("--keywords", "-k", help="Search keywords", required=True)
78
- @option("--region", "-r", help="Region for search results", default="wt-wt")
79
- @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
80
- @option("--timelimit", "-t", help="Time limit for results", default=None)
81
- @option("--backend", "-b", help="Search backend to use", default="api")
82
- @option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
83
- @option("--proxy", "-p", help="Proxy URL to use for requests")
84
- @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
85
- def text(keywords: str, region: str, safesearch: str, timelimit: str, backend: str, max_results: int, proxy: str = None, timeout: int = 10):
86
- """Perform a text search using DuckDuckGo API."""
87
- webs = WEBS(proxy=proxy, timeout=timeout)
88
- try:
89
- results = webs.text(keywords, region, safesearch, timelimit, backend, max_results)
90
- _print_data(results)
91
- except Exception as e:
92
- raise e
93
-
94
- @app.command()
95
- @option("--keywords", "-k", help="Search keywords", required=True)
96
- @option("--proxy", "-p", help="Proxy URL to use for requests")
97
- @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
98
- def answers(keywords: str, proxy: str = None, timeout: int = 10):
99
- """Perform an answers search using DuckDuckGo API."""
100
- webs = WEBS(proxy=proxy, timeout=timeout)
101
- try:
102
- results = webs.answers(keywords)
103
- _print_data(results)
104
- except Exception as e:
105
- raise e
106
-
107
- @app.command()
108
- @option("--keywords", "-k", help="Search keywords", required=True)
109
- @option("--region", "-r", help="Region for search results", default="wt-wt")
110
- @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
111
- @option("--timelimit", "-t", help="Time limit for results", default=None)
112
- @option("--size", "-size", help="Image size", default=None)
113
- @option("--color", "-c", help="Image color", default=None)
114
- @option("--type", "-type", help="Image type", default=None)
115
- @option("--layout", "-l", help="Image layout", default=None)
116
- @option("--license", "-lic", help="Image license", default=None)
117
- @option("--max-results", "-m", help="Maximum number of results", type=int, default=90)
118
- @option("--proxy", "-p", help="Proxy URL to use for requests")
119
- @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
120
- def images(
121
- keywords: str,
122
- region: str,
123
- safesearch: str,
124
- timelimit: str,
125
- size: str,
126
- color: str,
127
- type: str,
128
- layout: str,
129
- license: str,
130
- max_results: int,
131
- proxy: str = None,
132
- timeout: int = 10,
133
- ):
134
- """Perform an images search using DuckDuckGo API."""
135
- webs = WEBS(proxy=proxy, timeout=timeout)
136
- try:
137
- results = webs.images(keywords, region, safesearch, timelimit, size, color, type, layout, license, max_results)
138
- _print_data(results)
139
- except Exception as e:
140
- raise e
141
-
142
- @app.command()
143
- @option("--keywords", "-k", help="Search keywords", required=True)
144
- @option("--region", "-r", help="Region for search results", default="wt-wt")
145
- @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
146
- @option("--timelimit", "-t", help="Time limit for results", default=None)
147
- @option("--resolution", "-res", help="Video resolution", default=None)
148
- @option("--duration", "-d", help="Video duration", default=None)
149
- @option("--license", "-lic", help="Video license", default=None)
150
- @option("--max-results", "-m", help="Maximum number of results", type=int, default=50)
151
- @option("--proxy", "-p", help="Proxy URL to use for requests")
152
- @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
153
- def videos(
154
- keywords: str,
155
- region: str,
156
- safesearch: str,
157
- timelimit: str,
158
- resolution: str,
159
- duration: str,
160
- license: str,
161
- max_results: int,
162
- proxy: str = None,
163
- timeout: int = 10,
164
- ):
165
- """Perform a videos search using DuckDuckGo API."""
166
- webs = WEBS(proxy=proxy, timeout=timeout)
167
- try:
168
- results = webs.videos(keywords, region, safesearch, timelimit, resolution, duration, license, max_results)
169
- _print_data(results)
170
- except Exception as e:
171
- raise e
172
-
173
- @app.command()
174
- @option("--keywords", "-k", help="Search keywords", required=True)
175
- @option("--region", "-r", help="Region for search results", default="wt-wt")
176
- @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
177
- @option("--timelimit", "-t", help="Time limit for results", default=None)
178
- @option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
179
- @option("--proxy", "-p", help="Proxy URL to use for requests")
180
- @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
181
- def news(keywords: str, region: str, safesearch: str, timelimit: str, max_results: int, proxy: str = None, timeout: int = 10):
182
- """Perform a news search using DuckDuckGo API."""
183
- webs = WEBS(proxy=proxy, timeout=timeout)
184
- try:
185
- results = webs.news(keywords, region, safesearch, timelimit, max_results)
186
- _print_data(results)
187
- except Exception as e:
188
- raise e
189
-
190
- @app.command()
191
- @option("--keywords", "-k", help="Search keywords", required=True)
192
- @option("--place", "-p", help="Simplified search - if set, the other parameters are not used")
193
- @option("--street", "-s", help="House number/street")
194
- @option("--city", "-c", help="City of search")
195
- @option("--county", "-county", help="County of search")
196
- @option("--state", "-state", help="State of search")
197
- @option("--country", "-country", help="Country of search")
198
- @option("--postalcode", "-post", help="Postal code of search")
199
- @option("--latitude", "-lat", help="Geographic coordinate (north-south position)")
200
- @option("--longitude", "-lon", help="Geographic coordinate (east-west position); if latitude and longitude are set, the other parameters are not used")
201
- @option("--radius", "-r", help="Expand the search square by the distance in kilometers", type=int, default=0)
202
- @option("--max-results", "-m", help="Number of results", type=int, default=50)
203
- @option("--proxy", "-p", help="Proxy URL to use for requests")
204
- @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
205
- def maps(
206
- keywords: str,
207
- place: str,
208
- street: str,
209
- city: str,
210
- county: str,
211
- state: str,
212
- country: str,
213
- postalcode: str,
214
- latitude: str,
215
- longitude: str,
216
- radius: int,
217
- max_results: int,
218
- proxy: str = None,
219
- timeout: int = 10,
220
- ):
221
- """Perform a maps search using DuckDuckGo API."""
222
- webs = WEBS(proxy=proxy, timeout=timeout)
223
- try:
224
- results = webs.maps(
225
- keywords,
226
- place,
227
- street,
228
- city,
229
- county,
230
- state,
231
- country,
232
- postalcode,
233
- latitude,
234
- longitude,
235
- radius,
236
- max_results,
237
- )
238
- _print_data(results)
239
- except Exception as e:
240
- raise e
241
-
242
- @app.command()
243
- @option("--keywords", "-k", help="Text for translation", required=True)
244
- @option("--from", "-f", help="Language to translate from (defaults automatically)")
245
- @option("--to", "-t", help="Language to translate to (default: 'en')", default="en")
246
- @option("--proxy", "-p", help="Proxy URL to use for requests")
247
- @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
248
- def translate(keywords: str, from_: str, to: str, proxy: str = None, timeout: int = 10):
249
- """Perform translation using DuckDuckGo API."""
250
- webs = WEBS(proxy=proxy, timeout=timeout)
251
- try:
252
- results = webs.translate(keywords, from_, to)
253
- _print_data(results)
254
- except Exception as e:
255
- raise e
256
-
257
- @app.command()
258
- @option("--keywords", "-k", help="Search keywords", required=True)
259
- @option("--region", "-r", help="Region for search results", default="wt-wt")
260
- @option("--proxy", "-p", help="Proxy URL to use for requests")
261
- @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
262
- def suggestions(keywords: str, region: str, proxy: str = None, timeout: int = 10):
263
- """Perform a suggestions search using DuckDuckGo API."""
264
- webs = WEBS(proxy=proxy, timeout=timeout)
265
- try:
266
- results = webs.suggestions(keywords, region)
267
- _print_data(results)
268
- except Exception as e:
269
- raise e
270
-
271
- @app.command()
272
- @option("--location", "-l", help="Location to get weather for", required=True)
273
- @option("--language", "-lang", help="Language code (e.g. 'en', 'es')", default="en")
274
- @option("--proxy", "-p", help="Proxy URL to use for requests")
275
- @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
276
- def weather(location: str, language: str, proxy: str = None, timeout: int = 10):
277
- """Get weather information for a location from DuckDuckGo."""
278
- webs = WEBS(proxy=proxy, timeout=timeout)
279
- try:
280
- results = webs.weather(location, language)
281
- _print_weather(results)
282
- except Exception as e:
283
- raise e
284
-
285
- def main():
286
- """Main entry point for the CLI."""
287
- try:
288
- app.run()
289
- except Exception as e:
290
- sys.exit(1)
291
-
292
- if __name__ == "__main__":
293
- main()
1
+ import sys
2
+ from .swiftcli import CLI, option
3
+ from .webscout_search import WEBS
4
+ from .version import __version__
5
+
6
+
7
+ def _print_data(data):
8
+ """Prints data in a simple formatted way."""
9
+ if data:
10
+ for i, e in enumerate(data, start=1):
11
+ print(f"\nResult {i}:")
12
+ print("-" * 50)
13
+ for k, v in e.items():
14
+ if v:
15
+ k = "language" if k == "detected_language" else k
16
+ print(f"{k:15}: {v}")
17
+ print("-" * 50)
18
+
19
+ def _print_weather(data):
20
+ """Prints weather data in a clean format."""
21
+ current = data["current"]
22
+
23
+ print(f"\nCurrent Weather in {data['location']}:")
24
+ print("-" * 50)
25
+ print(f"Temperature: {current['temperature_c']}°C")
26
+ print(f"Feels Like: {current['feels_like_c']}°C")
27
+ print(f"Humidity: {current['humidity']}%")
28
+ print(f"Wind: {current['wind_speed_ms']} m/s")
29
+ print(f"Direction: {current['wind_direction']}°")
30
+ print("-" * 50)
31
+
32
+ print("\n5-Day Forecast:")
33
+ print("-" * 50)
34
+ print(f"{'Date':10} {'Condition':15} {'High':8} {'Low':8}")
35
+ print("-" * 50)
36
+
37
+ for day in data["daily_forecast"][:5]:
38
+ print(f"{day['date']:10} {day['condition']:15} {day['max_temp_c']:8.1f}°C {day['min_temp_c']:8.1f}°C")
39
+ print("-" * 50)
40
+
41
+ # Initialize CLI app
42
+ app = CLI(name="webscout", help="Search the web with a simple UI", version=__version__)
43
+
44
+ @app.command()
45
+ def version():
46
+ """Show the version of webscout."""
47
+ print(f"webscout version: {__version__}")
48
+
49
+ @app.command()
50
+ @option("--proxy", help="Proxy URL to use for requests")
51
+ @option("--model", "-m", help="AI model to use", default="gpt-4o-mini", type=str)
52
+ @option("--timeout", "-t", help="Timeout value for requests", type=int, default=10)
53
+ def chat(proxy: str = None, model: str = "gpt-4o-mini", timeout: int = 10):
54
+ """Interactive AI chat using DuckDuckGo's AI."""
55
+ webs = WEBS(proxy=proxy, timeout=timeout)
56
+
57
+ print(f"Using model: {model}")
58
+ print("Type your message and press Enter. Press Ctrl+C or type 'exit' to quit.\n")
59
+
60
+ try:
61
+ while True:
62
+ try:
63
+ user_input = input(">>> ").strip()
64
+ if not user_input or user_input.lower() in ['exit', 'quit']:
65
+ break
66
+
67
+ response = webs.chat(keywords=user_input, model=model)
68
+ print(f"\nAI: {response}\n")
69
+
70
+ except Exception as e:
71
+ print(f"Error: {str(e)}\n")
72
+
73
+ except KeyboardInterrupt:
74
+ print("\nChat session interrupted. Exiting...")
75
+
76
+ @app.command()
77
+ @option("--keywords", "-k", help="Search keywords", required=True)
78
+ @option("--region", "-r", help="Region for search results", default="wt-wt")
79
+ @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
80
+ @option("--timelimit", "-t", help="Time limit for results", default=None)
81
+ @option("--backend", "-b", help="Search backend to use", default="api")
82
+ @option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
83
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
84
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
85
+ def text(keywords: str, region: str, safesearch: str, timelimit: str, backend: str, max_results: int, proxy: str = None, timeout: int = 10):
86
+ """Perform a text search using DuckDuckGo API."""
87
+ webs = WEBS(proxy=proxy, timeout=timeout)
88
+ try:
89
+ results = webs.text(keywords, region, safesearch, timelimit, backend, max_results)
90
+ _print_data(results)
91
+ except Exception as e:
92
+ raise e
93
+
94
+ @app.command()
95
+ @option("--keywords", "-k", help="Search keywords", required=True)
96
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
97
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
98
+ def answers(keywords: str, proxy: str = None, timeout: int = 10):
99
+ """Perform an answers search using DuckDuckGo API."""
100
+ webs = WEBS(proxy=proxy, timeout=timeout)
101
+ try:
102
+ results = webs.answers(keywords)
103
+ _print_data(results)
104
+ except Exception as e:
105
+ raise e
106
+
107
+ @app.command()
108
+ @option("--keywords", "-k", help="Search keywords", required=True)
109
+ @option("--region", "-r", help="Region for search results", default="wt-wt")
110
+ @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
111
+ @option("--timelimit", "-t", help="Time limit for results", default=None)
112
+ @option("--size", "-size", help="Image size", default=None)
113
+ @option("--color", "-c", help="Image color", default=None)
114
+ @option("--type", "-type", help="Image type", default=None)
115
+ @option("--layout", "-l", help="Image layout", default=None)
116
+ @option("--license", "-lic", help="Image license", default=None)
117
+ @option("--max-results", "-m", help="Maximum number of results", type=int, default=90)
118
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
119
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
120
+ def images(
121
+ keywords: str,
122
+ region: str,
123
+ safesearch: str,
124
+ timelimit: str,
125
+ size: str,
126
+ color: str,
127
+ type: str,
128
+ layout: str,
129
+ license: str,
130
+ max_results: int,
131
+ proxy: str = None,
132
+ timeout: int = 10,
133
+ ):
134
+ """Perform an images search using DuckDuckGo API."""
135
+ webs = WEBS(proxy=proxy, timeout=timeout)
136
+ try:
137
+ results = webs.images(keywords, region, safesearch, timelimit, size, color, type, layout, license, max_results)
138
+ _print_data(results)
139
+ except Exception as e:
140
+ raise e
141
+
142
+ @app.command()
143
+ @option("--keywords", "-k", help="Search keywords", required=True)
144
+ @option("--region", "-r", help="Region for search results", default="wt-wt")
145
+ @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
146
+ @option("--timelimit", "-t", help="Time limit for results", default=None)
147
+ @option("--resolution", "-res", help="Video resolution", default=None)
148
+ @option("--duration", "-d", help="Video duration", default=None)
149
+ @option("--license", "-lic", help="Video license", default=None)
150
+ @option("--max-results", "-m", help="Maximum number of results", type=int, default=50)
151
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
152
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
153
+ def videos(
154
+ keywords: str,
155
+ region: str,
156
+ safesearch: str,
157
+ timelimit: str,
158
+ resolution: str,
159
+ duration: str,
160
+ license: str,
161
+ max_results: int,
162
+ proxy: str = None,
163
+ timeout: int = 10,
164
+ ):
165
+ """Perform a videos search using DuckDuckGo API."""
166
+ webs = WEBS(proxy=proxy, timeout=timeout)
167
+ try:
168
+ results = webs.videos(keywords, region, safesearch, timelimit, resolution, duration, license, max_results)
169
+ _print_data(results)
170
+ except Exception as e:
171
+ raise e
172
+
173
+ @app.command()
174
+ @option("--keywords", "-k", help="Search keywords", required=True)
175
+ @option("--region", "-r", help="Region for search results", default="wt-wt")
176
+ @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
177
+ @option("--timelimit", "-t", help="Time limit for results", default=None)
178
+ @option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
179
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
180
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
181
+ def news(keywords: str, region: str, safesearch: str, timelimit: str, max_results: int, proxy: str = None, timeout: int = 10):
182
+ """Perform a news search using DuckDuckGo API."""
183
+ webs = WEBS(proxy=proxy, timeout=timeout)
184
+ try:
185
+ results = webs.news(keywords, region, safesearch, timelimit, max_results)
186
+ _print_data(results)
187
+ except Exception as e:
188
+ raise e
189
+
190
+ @app.command()
191
+ @option("--keywords", "-k", help="Search keywords", required=True)
192
+ @option("--place", "-p", help="Simplified search - if set, the other parameters are not used")
193
+ @option("--street", "-s", help="House number/street")
194
+ @option("--city", "-c", help="City of search")
195
+ @option("--county", "-county", help="County of search")
196
+ @option("--state", "-state", help="State of search")
197
+ @option("--country", "-country", help="Country of search")
198
+ @option("--postalcode", "-post", help="Postal code of search")
199
+ @option("--latitude", "-lat", help="Geographic coordinate (north-south position)")
200
+ @option("--longitude", "-lon", help="Geographic coordinate (east-west position); if latitude and longitude are set, the other parameters are not used")
201
+ @option("--radius", "-r", help="Expand the search square by the distance in kilometers", type=int, default=0)
202
+ @option("--max-results", "-m", help="Number of results", type=int, default=50)
203
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
204
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
205
+ def maps(
206
+ keywords: str,
207
+ place: str,
208
+ street: str,
209
+ city: str,
210
+ county: str,
211
+ state: str,
212
+ country: str,
213
+ postalcode: str,
214
+ latitude: str,
215
+ longitude: str,
216
+ radius: int,
217
+ max_results: int,
218
+ proxy: str = None,
219
+ timeout: int = 10,
220
+ ):
221
+ """Perform a maps search using DuckDuckGo API."""
222
+ webs = WEBS(proxy=proxy, timeout=timeout)
223
+ try:
224
+ results = webs.maps(
225
+ keywords,
226
+ place,
227
+ street,
228
+ city,
229
+ county,
230
+ state,
231
+ country,
232
+ postalcode,
233
+ latitude,
234
+ longitude,
235
+ radius,
236
+ max_results,
237
+ )
238
+ _print_data(results)
239
+ except Exception as e:
240
+ raise e
241
+
242
+ @app.command()
243
+ @option("--keywords", "-k", help="Text for translation", required=True)
244
+ @option("--from", "-f", help="Language to translate from (defaults automatically)")
245
+ @option("--to", "-t", help="Language to translate to (default: 'en')", default="en")
246
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
247
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
248
+ def translate(keywords: str, from_: str, to: str, proxy: str = None, timeout: int = 10):
249
+ """Perform translation using DuckDuckGo API."""
250
+ webs = WEBS(proxy=proxy, timeout=timeout)
251
+ try:
252
+ results = webs.translate(keywords, from_, to)
253
+ _print_data(results)
254
+ except Exception as e:
255
+ raise e
256
+
257
+ @app.command()
258
+ @option("--keywords", "-k", help="Search keywords", required=True)
259
+ @option("--region", "-r", help="Region for search results", default="wt-wt")
260
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
261
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
262
+ def suggestions(keywords: str, region: str, proxy: str = None, timeout: int = 10):
263
+ """Perform a suggestions search using DuckDuckGo API."""
264
+ webs = WEBS(proxy=proxy, timeout=timeout)
265
+ try:
266
+ results = webs.suggestions(keywords, region)
267
+ _print_data(results)
268
+ except Exception as e:
269
+ raise e
270
+
271
+ @app.command()
272
+ @option("--location", "-l", help="Location to get weather for", required=True)
273
+ @option("--language", "-lang", help="Language code (e.g. 'en', 'es')", default="en")
274
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
275
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
276
+ def weather(location: str, language: str, proxy: str = None, timeout: int = 10):
277
+ """Get weather information for a location from DuckDuckGo."""
278
+ webs = WEBS(proxy=proxy, timeout=timeout)
279
+ try:
280
+ results = webs.weather(location, language)
281
+ _print_weather(results)
282
+ except Exception as e:
283
+ raise e
284
+
285
+ def main():
286
+ """Main entry point for the CLI."""
287
+ try:
288
+ app.run()
289
+ except Exception as e:
290
+ sys.exit(1)
291
+
292
+ if __name__ == "__main__":
293
+ main()