webscout 1.3.3__py3-none-any.whl → 1.3.4__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.

@@ -78,20 +78,18 @@ class BatchWebpageFetcher:
78
78
  self.urls = urls
79
79
  self.total_count = len(self.urls)
80
80
 
81
- with concurrent.futures.ThreadPoolExecutor() as executor:
81
+ with concurrent.futures.ProcessPoolExecutor() as executor:
82
82
  futures = [
83
- executor.submit(self.fetch_single_webpage, url, overwrite, output_parent)
83
+ executor.submit(WebpageFetcher().fetch, url, overwrite, output_parent)
84
84
  for url in urls
85
85
  ]
86
86
  concurrent.futures.wait(futures)
87
87
 
88
+ self.url_and_html_path_list = [
89
+ {"url": future.result().url, "html_path": str(future.result().html_path)}
90
+ for future in futures
91
+ ]
92
+
88
93
  return self.url_and_html_path_list
89
94
 
90
- if __name__ == "__main__":
91
- urls = [
92
- "https://stackoverflow.com/questions/295135/turn-a-string-into-a-valid-filename",
93
- "https://www.liaoxuefeng.com/wiki/1016959663602400/1017495723838528",
94
- "https://docs.python.org/zh-cn/3/tutorial/interpreter.html",
95
- ]
96
- batch_webpage_fetcher = BatchWebpageFetcher()
97
- batch_webpage_fetcher.fetch(urls=urls, overwrite=True, output_parent="python tutorials")
95
+
DeepWEBS/utilsdw/enver.py CHANGED
@@ -1,25 +1,41 @@
1
1
  import json
2
2
  import os
3
-
4
3
  from pathlib import Path
5
- from DeepWEBS.utilsdw.logger import logger
4
+ from typing import Dict, Optional
5
+
6
+ from DeepWEBS.utilsdw.logger import OSLogger
6
7
 
7
8
 
8
9
  class OSEnver:
9
- def __init__(self):
10
- self.envs_stack = []
11
- self.envs = os.environ.copy()
10
+ """Manages the OS environment variables."""
11
+
12
+ def __init__(self) -> None:
13
+ """Initializes the OSEnver object."""
14
+ self.envs_stack: list[Dict[str, str]] = []
15
+ self.envs: Dict[str, str] = os.environ.copy()
12
16
 
13
- def store_envs(self):
14
- self.envs_stack.append(self.envs)
17
+ def store_envs(self) -> None:
18
+ """Stores a copy of the current environment variables on a stack."""
19
+ self.envs_stack.append(self.envs.copy())
15
20
 
16
- def restore_envs(self):
21
+ def restore_envs(self) -> None:
22
+ """Restores environment variables from the top of the stack."""
17
23
  self.envs = self.envs_stack.pop()
18
24
 
19
- def set_envs(self, secrets=True, proxies=None, store_envs=True):
20
- # caller_info = inspect.stack()[1]
21
- # logger.back(f"OS Envs is set by: {caller_info.filename}")
25
+ def set_envs(
26
+ self,
27
+ secrets: bool = True,
28
+ proxies: Optional[str] = None,
29
+ store_envs: bool = True,
30
+ ) -> None:
31
+ """Sets environment variables based on the contents of secrets.json.
22
32
 
33
+ Args:
34
+ secrets (bool): Whether to load secrets from secrets.json.
35
+ proxies (Optional[str]): Proxy URL to set as environment variable.
36
+ store_envs (bool): Whether to store a copy of the environment variables
37
+ on the stack.
38
+ """
23
39
  if store_envs:
24
40
  self.store_envs()
25
41
 
@@ -54,7 +70,9 @@ class OSEnver:
54
70
  }
55
71
 
56
72
  if self.proxy:
57
- logger.note(f"Using proxy: [{self.proxy}]")
73
+ OSLogger().note(f"Using proxy: [{self.proxy}]")
74
+
75
+
76
+ enver: OSEnver = OSEnver()
58
77
 
59
78
 
60
- enver = OSEnver()
webscout/AIutel.py CHANGED
@@ -10,14 +10,31 @@ import sys
10
10
  import click
11
11
  from rich.markdown import Markdown
12
12
  from rich.console import Console
13
-
13
+ import g4f
14
14
  appdir = appdirs.AppDirs("AIWEBS", "vortex")
15
15
 
16
16
  default_path = appdir.user_cache_dir
17
17
 
18
18
  if not os.path.exists(default_path):
19
19
  os.makedirs(default_path)
20
-
20
+ webai = [
21
+ "leo",
22
+ "openai",
23
+ "opengpt",
24
+ "koboldai",
25
+ "gemini",
26
+ "phind",
27
+ "blackboxai",
28
+ "g4fauto",
29
+ "perplexity",
30
+ "sean",
31
+ ]
32
+
33
+ gpt4free_providers = [
34
+ provider.__name__ for provider in g4f.Provider.__providers__ # if provider.working
35
+ ]
36
+
37
+ available_providers = webai + gpt4free_providers
21
38
 
22
39
  def run_system_command(
23
40
  command: str,
@@ -468,7 +485,6 @@ print("The essay is about...")
468
485
  ```
469
486
  """
470
487
 
471
- # Idea borrowed from https://github.com/AbanteAI/rawdog
472
488
 
473
489
  def __init__(
474
490
  self,
webscout/__init__.py CHANGED
@@ -1,7 +1,6 @@
1
1
  """Webscout.
2
2
 
3
- Search for words, documents, images, videos, news, maps and text translation
4
- using the Google, DuckDuckGo.com, yep.com, phind.com, you.com, etc Also containes AI models
3
+ Search for anything using the Google, DuckDuckGo.com, yep.com, phind.com, you.com, etc Also containes AI models, can transcribe yt videos, have TTS support and now has webai(terminal gpt and open interpeter) support
5
4
  """
6
5
  import g4f
7
6
  import logging
webscout/g4f.py CHANGED
@@ -2,7 +2,7 @@ import g4f
2
2
  from webscout.AIutel import Optimizers
3
3
  from webscout.AIutel import Conversation
4
4
  from webscout.AIutel import AwesomePrompts
5
- from webscout.AIutel import Provider
5
+ from webscout.AIbase import Provider
6
6
  from webscout.AIutel import available_providers
7
7
 
8
8
 
webscout/version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "1.3.3"
1
+ __version__ = "1.3.4"
2
2
 
webscout/webai.py CHANGED
@@ -29,6 +29,7 @@ from webscout.AIutel import Optimizers
29
29
  from webscout.AIutel import default_path
30
30
  from webscout.AIutel import AwesomePrompts
31
31
  from webscout.AIutel import RawDog
32
+ from webscout import available_providers
32
33
  from colorama import Fore
33
34
  from colorama import init as init_colorama
34
35
  from dotenv import load_dotenv
@@ -41,7 +42,7 @@ init_colorama(autoreset=True)
41
42
  load_dotenv() # loads .env variables
42
43
 
43
44
  logging.basicConfig(
44
- format="%(asctime)s - %(levelname)s : %(message)s ", # [%(module)s,%(lineno)s]", # for debug purposes
45
+ format="%(asctime)s - %(levelname)s : %(message)s ",
45
46
  datefmt="%H:%M:%S",
46
47
  level=logging.INFO,
47
48
  )
@@ -61,7 +62,7 @@ class this:
61
62
 
62
63
  rich_code_themes = ["monokai", "paraiso-dark", "igor", "vs", "fruity", "xcode"]
63
64
 
64
- default_provider = "sean"
65
+ default_provider = "phind"
65
66
 
66
67
  getExc = lambda e: e.args[1] if len(e.args) > 1 else str(e)
67
68
 
@@ -1077,7 +1078,7 @@ class EntryGroup:
1077
1078
  pass
1078
1079
 
1079
1080
 
1080
-
1081
+ import webscout
1081
1082
  class Chatwebai:
1082
1083
  """webai command"""
1083
1084
 
@@ -1194,7 +1195,7 @@ class Chatwebai:
1194
1195
  @click.option(
1195
1196
  "-p",
1196
1197
  "--provider",
1197
- type=click.Choice(webscout.available_providers),
1198
+ type=click.Choice(available_providers),
1198
1199
  default=this.default_provider,
1199
1200
  help="Name of LLM provider.",
1200
1201
  metavar=(
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: webscout
3
- Version: 1.3.3
4
- Summary: Search for words, documents, images, videos, news, maps and text translation using the Google, DuckDuckGo.com, yep.com, phind.com, you.com, etc Also containes AI models, can transcribe yt videos and have TTS support
3
+ Version: 1.3.4
4
+ Summary: Search for anything using the Google, DuckDuckGo.com, yep.com, phind.com, you.com, etc Also containes AI models, can transcribe yt videos, have TTS support and now has webai(terminal gpt and open interpeter) support
5
5
  Author: OEvortex
6
6
  Author-email: helpingai5@gmail.com
7
7
  License: HelpingAI Simplified Universal License
@@ -56,7 +56,7 @@ Requires-Dist: pytest >=7.4.2 ; extra == 'dev'
56
56
  <a href="#"><img alt="Python version" src="https://img.shields.io/pypi/pyversions/webscout"/></a>
57
57
  <a href="https://pepy.tech/project/webscout"><img alt="Downloads" src="https://static.pepy.tech/badge/webscout"></a>
58
58
 
59
- Search for words, documents, images, videos, news, maps and text translation using the Google, DuckDuckGo.com, yep.com, phind.com, you.com, etc Also containes AI models and now can transcribe yt videos
59
+ Search for anything using the Google, DuckDuckGo.com, yep.com, phind.com, you.com, etc Also containes AI models, can transcribe yt videos, have TTS support and now has webai(terminal gpt and open interpeter) support
60
60
 
61
61
 
62
62
  ## Table of Contents
@@ -100,6 +100,8 @@ Search for words, documents, images, videos, news, maps and text translation usi
100
100
  - [usage of special .LLM file from webscout (webscout.LLM)](#usage-of-special-llm-file-from-webscout-webscoutllm)
101
101
  - [`LLM`](#llm)
102
102
  - [`LLM` with internet](#llm-with-internet)
103
+ - [`Webai` - terminal gpt and a open interpeter](#webai---terminal-gpt-and-a-open-interpeter)
104
+ - [for using as terminal gpt](#for-using-as-terminal-gpt)
103
105
 
104
106
  ## Install
105
107
  ```python
@@ -801,3 +803,49 @@ if __name__ == "__main__":
801
803
  else:
802
804
  print("No response")
803
805
  ```
806
+ ## `Webai` - terminal gpt and a open interpeter
807
+
808
+ ```python
809
+ from webscout.webai import Main
810
+
811
+ def use_rawdog_with_webai(prompt):
812
+ """
813
+ Wrap the webscout default method in a try-except block to catch any unhandled
814
+ exceptions and print a helpful message.
815
+ """
816
+ try:
817
+ webai_bot = Main(
818
+ max_tokens=500,
819
+ provider="phind",
820
+ temperature=0.7,
821
+ top_k=40,
822
+ top_p=0.95,
823
+ model="Phind Model", # Replace with your desired model
824
+ auth=None, # Replace with your auth key/value (if needed)
825
+ timeout=30,
826
+ disable_conversation=True,
827
+ filepath=None,
828
+ update_file=True,
829
+ intro=None,
830
+ rawdog=True,
831
+ history_offset=10250,
832
+ awesome_prompt=None,
833
+ proxy_path=None,
834
+ quiet=True
835
+ )
836
+ webai_response = webai_bot.default(prompt)
837
+ except Exception as e:
838
+ print("Unexpected error:", e)
839
+
840
+
841
+ if __name__ == "__main__":
842
+ user_prompt = input("Enter your prompt: ")
843
+ use_rawdog_with_webai(user_prompt)
844
+ ```
845
+ ```shell
846
+ python -m webscout.webai webai --provider "phind" --rawdog
847
+ ```
848
+ ### for using as terminal gpt
849
+ ```python
850
+ python -m webscout.webai webai --provider "sean"
851
+ ```
@@ -6,32 +6,32 @@ DeepWEBS/networks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
6
6
  DeepWEBS/networks/filepath_converter.py,sha256=JKMBew1TYe4TVoGTqgTWerq2Pam49_9u9TVUFCTDQyk,3183
7
7
  DeepWEBS/networks/google_searcher.py,sha256=-AdIpVkRgemsARnOt8WPkF2Id1baVlqDHyqX2qz8Aew,1966
8
8
  DeepWEBS/networks/network_configs.py,sha256=-Hb78_7SBx32h219FnU14qcHTvBdDUf_QAU6-RTL_e0,726
9
- DeepWEBS/networks/webpage_fetcher.py,sha256=d5paDTB3wa_w6YWmLV7RkpAj8Lh8ztuUuyfe8RuTjQg,3846
9
+ DeepWEBS/networks/webpage_fetcher.py,sha256=vRB9T3o-nMgrMkG2NPHTDctNeXaPSKCmBXqu189h2ZI,3590
10
10
  DeepWEBS/utilsdw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- DeepWEBS/utilsdw/enver.py,sha256=vstxg_5P3Rwo1en6oPcuc2SBiATJqxi4C7meGmw5w0M,1754
11
+ DeepWEBS/utilsdw/enver.py,sha256=vpI7s4_o_VL9govSryOv-z1zYK3pTEW3-H9QNN8JYtc,2472
12
12
  DeepWEBS/utilsdw/logger.py,sha256=Z0nFUcEGyU8r28yKiIyvEtO26xxpmJgbvNToTfwZecc,8174
13
13
  webscout/AI.py,sha256=9ZEctvGx558mmCva6c9lB5c0pbU-of5azle2F4Mpqhg,93054
14
14
  webscout/AIbase.py,sha256=vQi2ougu5bG-QdmoYmxCQsOg7KTEgG7EF6nZh5qqUGw,2343
15
- webscout/AIutel.py,sha256=j8NY4AgJbq3YLosX2R3QShtmjIM0UivXS_iCoMSIZiY,24126
15
+ webscout/AIutel.py,sha256=rVbQwPSqrsUc0vZDMn2bXO6n0w479QUOljBYFRNH76Q,24413
16
16
  webscout/DWEBS.py,sha256=QT-7-dUgWhQ_H7EVZD53AVyXxyskoPMKCkFIpzkN56Q,7332
17
17
  webscout/HelpingAI.py,sha256=YeZw0zYVHMcBFFPNdd3_Ghpm9ebt_EScQjHO_IIs4lg,8103
18
18
  webscout/LLM.py,sha256=CiDz0okZNEoXuxMwadZnwRGSLpqk2zg0vzvXSxQZjcE,1910
19
- webscout/__init__.py,sha256=rUXt0AOHdvrt53bAswMWToZ2bvqQ4of93xKd4xGl0uY,957
19
+ webscout/__init__.py,sha256=0RRjdP5ZM25pFJW8RslilZyQOLZtUUIjL-NqTJjePZA,1002
20
20
  webscout/__main__.py,sha256=ZtTRgsRjUi2JOvYFLF1ZCh55Sdoz94I-BS-TlJC7WDU,126
21
21
  webscout/cli.py,sha256=F888fdrFUQgczMBN4yMOSf6Nh-IbvkqpPhDsbnA2FtQ,17059
22
22
  webscout/exceptions.py,sha256=4AOO5wexeL96nvUS-badcckcwrPS7UpZyAgB9vknHZE,276
23
- webscout/g4f.py,sha256=9ovf-gLMDC3Bt6zGrwmZ3_PJh5fSVR4ipOlsaYxbgU0,16358
23
+ webscout/g4f.py,sha256=NEZbXOoVfmHiKcSjVpBMNKZzHgbTJLsd8xOXjtn4js4,16358
24
24
  webscout/models.py,sha256=5iQIdtedT18YuTZ3npoG7kLMwcrKwhQ7928dl_7qZW0,692
25
25
  webscout/transcriber.py,sha256=EddvTSq7dPJ42V3pQVnGuEiYQ7WjJ9uyeR9kMSxN7uY,20622
26
26
  webscout/utils.py,sha256=c_98M4oqpb54pUun3fpGGlCerFD6ZHUbghyp5b7Mwgo,2605
27
- webscout/version.py,sha256=EBB5uHyxxWvfz74zmklK5pUUb8DUYMAu8yaJy9KwDEU,25
27
+ webscout/version.py,sha256=Bw-PmcKUlfRVmyOF25uf1CLYn5NfqviwtSLQ0KmE2W8,25
28
28
  webscout/voice.py,sha256=1Ids_2ToPBMX0cH_UyPMkY_6eSE9H4Gazrl0ujPmFag,941
29
- webscout/webai.py,sha256=DdBuz2B_V1M-OIt6dPAn5LV0eNFBWn2hTP2cJy2qklI,73868
29
+ webscout/webai.py,sha256=ApxRQ6Us7-u_6kBACb1RSXbBFNEPHQhVdQobvns1Qkw,73868
30
30
  webscout/webscout_search.py,sha256=3_lli-hDb8_kCGwscK29xuUcOS833ROgpNhDzrxh0dk,3085
31
31
  webscout/webscout_search_async.py,sha256=Y5frH0k3hLqBCR-8dn7a_b7EvxdYxn6wHiKl3jWosE0,40670
32
- webscout-1.3.3.dist-info/LICENSE.md,sha256=mRVwJuT4SXC5O93BFdsfWBjlXjGn2Np90Zm5SocUzM0,3150
33
- webscout-1.3.3.dist-info/METADATA,sha256=VguyWlPTREI2JlEi3pMK1CPD1-JJjGabRqYmdxSd73k,30440
34
- webscout-1.3.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
35
- webscout-1.3.3.dist-info/entry_points.txt,sha256=8-93eRslYrzTHs5E-6yFRJrve00C9q-SkXJD113jzRY,197
36
- webscout-1.3.3.dist-info/top_level.txt,sha256=OD5YKy6Y3hldL7SmuxsiEDxAG4LgdSSWwzYk22MF9fk,18
37
- webscout-1.3.3.dist-info/RECORD,,
32
+ webscout-1.3.4.dist-info/LICENSE.md,sha256=mRVwJuT4SXC5O93BFdsfWBjlXjGn2Np90Zm5SocUzM0,3150
33
+ webscout-1.3.4.dist-info/METADATA,sha256=t6lU_0POPrMQnuCKyA04SjkhxKS0cMtHr0-oYW-2cPg,31961
34
+ webscout-1.3.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
35
+ webscout-1.3.4.dist-info/entry_points.txt,sha256=8-93eRslYrzTHs5E-6yFRJrve00C9q-SkXJD113jzRY,197
36
+ webscout-1.3.4.dist-info/top_level.txt,sha256=OD5YKy6Y3hldL7SmuxsiEDxAG4LgdSSWwzYk22MF9fk,18
37
+ webscout-1.3.4.dist-info/RECORD,,