webscout 8.3.2__py3-none-any.whl โ†’ 8.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.

Files changed (117) hide show
  1. webscout/AIutel.py +367 -41
  2. webscout/Bard.py +2 -22
  3. webscout/Bing_search.py +1 -2
  4. webscout/Provider/AISEARCH/__init__.py +1 -0
  5. webscout/Provider/AISEARCH/scira_search.py +24 -11
  6. webscout/Provider/AISEARCH/stellar_search.py +132 -0
  7. webscout/Provider/Deepinfra.py +75 -57
  8. webscout/Provider/ExaChat.py +93 -63
  9. webscout/Provider/Flowith.py +1 -1
  10. webscout/Provider/FreeGemini.py +2 -2
  11. webscout/Provider/Gemini.py +3 -10
  12. webscout/Provider/GeminiProxy.py +31 -5
  13. webscout/Provider/HeckAI.py +85 -80
  14. webscout/Provider/Jadve.py +56 -50
  15. webscout/Provider/LambdaChat.py +39 -31
  16. webscout/Provider/MiniMax.py +207 -0
  17. webscout/Provider/Nemotron.py +41 -13
  18. webscout/Provider/Netwrck.py +39 -59
  19. webscout/Provider/OLLAMA.py +8 -9
  20. webscout/Provider/OPENAI/BLACKBOXAI.py +0 -1
  21. webscout/Provider/OPENAI/MiniMax.py +298 -0
  22. webscout/Provider/OPENAI/README.md +31 -30
  23. webscout/Provider/OPENAI/TogetherAI.py +4 -17
  24. webscout/Provider/OPENAI/__init__.py +4 -2
  25. webscout/Provider/OPENAI/autoproxy.py +753 -18
  26. webscout/Provider/OPENAI/base.py +7 -76
  27. webscout/Provider/OPENAI/copilot.py +73 -26
  28. webscout/Provider/OPENAI/deepinfra.py +96 -132
  29. webscout/Provider/OPENAI/exachat.py +9 -5
  30. webscout/Provider/OPENAI/flowith.py +179 -166
  31. webscout/Provider/OPENAI/friendli.py +233 -0
  32. webscout/Provider/OPENAI/monochat.py +329 -0
  33. webscout/Provider/OPENAI/netwrck.py +4 -7
  34. webscout/Provider/OPENAI/pydantic_imports.py +1 -172
  35. webscout/Provider/OPENAI/qodo.py +630 -0
  36. webscout/Provider/OPENAI/scirachat.py +82 -49
  37. webscout/Provider/OPENAI/textpollinations.py +13 -12
  38. webscout/Provider/OPENAI/toolbaz.py +1 -0
  39. webscout/Provider/OPENAI/typegpt.py +4 -4
  40. webscout/Provider/OPENAI/utils.py +19 -42
  41. webscout/Provider/OPENAI/x0gpt.py +14 -2
  42. webscout/Provider/OpenGPT.py +54 -32
  43. webscout/Provider/PI.py +58 -84
  44. webscout/Provider/Qodo.py +454 -0
  45. webscout/Provider/StandardInput.py +32 -13
  46. webscout/Provider/TTI/README.md +9 -9
  47. webscout/Provider/TTI/__init__.py +2 -1
  48. webscout/Provider/TTI/aiarta.py +92 -78
  49. webscout/Provider/TTI/infip.py +212 -0
  50. webscout/Provider/TTI/monochat.py +220 -0
  51. webscout/Provider/TeachAnything.py +11 -3
  52. webscout/Provider/TextPollinationsAI.py +91 -82
  53. webscout/Provider/TogetherAI.py +32 -48
  54. webscout/Provider/Venice.py +37 -46
  55. webscout/Provider/VercelAI.py +27 -24
  56. webscout/Provider/WiseCat.py +35 -35
  57. webscout/Provider/WrDoChat.py +22 -26
  58. webscout/Provider/WritingMate.py +26 -22
  59. webscout/Provider/__init__.py +6 -6
  60. webscout/Provider/copilot.py +58 -61
  61. webscout/Provider/freeaichat.py +64 -55
  62. webscout/Provider/granite.py +48 -57
  63. webscout/Provider/koala.py +51 -39
  64. webscout/Provider/learnfastai.py +49 -64
  65. webscout/Provider/llmchat.py +79 -93
  66. webscout/Provider/llmchatco.py +63 -78
  67. webscout/Provider/monochat.py +275 -0
  68. webscout/Provider/multichat.py +51 -40
  69. webscout/Provider/oivscode.py +1 -1
  70. webscout/Provider/scira_chat.py +257 -104
  71. webscout/Provider/scnet.py +13 -13
  72. webscout/Provider/searchchat.py +13 -13
  73. webscout/Provider/sonus.py +12 -11
  74. webscout/Provider/toolbaz.py +25 -8
  75. webscout/Provider/turboseek.py +41 -42
  76. webscout/Provider/typefully.py +27 -12
  77. webscout/Provider/typegpt.py +43 -48
  78. webscout/Provider/uncovr.py +55 -90
  79. webscout/Provider/x0gpt.py +325 -299
  80. webscout/Provider/yep.py +79 -96
  81. webscout/__init__.py +7 -2
  82. webscout/auth/__init__.py +12 -1
  83. webscout/auth/providers.py +27 -5
  84. webscout/auth/routes.py +146 -105
  85. webscout/auth/server.py +367 -312
  86. webscout/client.py +121 -116
  87. webscout/litagent/Readme.md +68 -55
  88. webscout/litagent/agent.py +99 -9
  89. webscout/version.py +1 -1
  90. {webscout-8.3.2.dist-info โ†’ webscout-8.3.4.dist-info}/METADATA +102 -91
  91. {webscout-8.3.2.dist-info โ†’ webscout-8.3.4.dist-info}/RECORD +95 -107
  92. webscout/Provider/AI21.py +0 -177
  93. webscout/Provider/HuggingFaceChat.py +0 -469
  94. webscout/Provider/OPENAI/freeaichat.py +0 -363
  95. webscout/Provider/TTI/fastflux.py +0 -233
  96. webscout/Provider/Writecream.py +0 -246
  97. webscout/auth/static/favicon.svg +0 -11
  98. webscout/auth/swagger_ui.py +0 -203
  99. webscout/auth/templates/components/authentication.html +0 -237
  100. webscout/auth/templates/components/base.html +0 -103
  101. webscout/auth/templates/components/endpoints.html +0 -750
  102. webscout/auth/templates/components/examples.html +0 -491
  103. webscout/auth/templates/components/footer.html +0 -75
  104. webscout/auth/templates/components/header.html +0 -27
  105. webscout/auth/templates/components/models.html +0 -286
  106. webscout/auth/templates/components/navigation.html +0 -70
  107. webscout/auth/templates/static/api.js +0 -455
  108. webscout/auth/templates/static/icons.js +0 -168
  109. webscout/auth/templates/static/main.js +0 -784
  110. webscout/auth/templates/static/particles.js +0 -201
  111. webscout/auth/templates/static/styles.css +0 -3353
  112. webscout/auth/templates/static/ui.js +0 -374
  113. webscout/auth/templates/swagger_ui.html +0 -170
  114. {webscout-8.3.2.dist-info โ†’ webscout-8.3.4.dist-info}/WHEEL +0 -0
  115. {webscout-8.3.2.dist-info โ†’ webscout-8.3.4.dist-info}/entry_points.txt +0 -0
  116. {webscout-8.3.2.dist-info โ†’ webscout-8.3.4.dist-info}/licenses/LICENSE.md +0 -0
  117. {webscout-8.3.2.dist-info โ†’ webscout-8.3.4.dist-info}/top_level.txt +0 -0
webscout/client.py CHANGED
@@ -1,116 +1,121 @@
1
- """
2
- Unified client import for OpenAI-compatible providers and server utilities.
3
-
4
- This module provides a unified import interface for all OpenAI-compatible providers and exposes
5
- helper functions to start the OpenAI-compatible API server programmatically.
6
-
7
- Usage:
8
- from webscout.client import FreeAIChat, AI4Chat, ExaChat, MultiChatAI, TwoAI, SciraChat, ChatSandbox, C4AI, Groq, TypeGPT, LLMChat, Cleeai, DeepInfra, BlackboxAI, Cloudflare, Netwrck, OIVSCode, Venice, Writecream, Wisecat, Yep, X0GPT, Sonus, Toolbaz, TextPollinations, StandardInput, Opkfc, Flowith, ExaAI, FreeGemini, GeminiAPI, Gemini, GithubChat, GizAI, Glider, HeckAI, HuggingFaceChat, Hunyuan, Jadve, Julius, Koala, LearnFast, LearnFastAI, NEMOTRON, MCPCore, PydanticImports, TeachAnything, UncovrAI, API, Base
9
- client = FreeAIChat()
10
- response = client.chat.completions.create(...)
11
-
12
- # To start the server programmatically:
13
- from webscout.client import start_server
14
- start_server()
15
-
16
- # For advanced server control:
17
- from webscout.client import run_api
18
- run_api(host="0.0.0.0", port=8000, debug=True)
19
-
20
- # Instantly start the API server from the command line:
21
- # python -m webscout.client
22
- # or, if installed as a script:
23
- # webscout-api
24
-
25
- Exports:
26
- - All OpenAI-compatible provider classes
27
- - start_server (function): Start the OpenAI-compatible API server with default or custom settings.
28
- - run_api (function): Advanced server startup with full control over host, port, and other options.
29
- """
30
-
31
- from webscout.Provider.OPENAI import *
32
-
33
- # Import server utilities from the FastAPI-compatible backend
34
- try:
35
- from webscout.auth.server import run_api
36
- # Provide a simple alias for starting the server with default settings
37
- def start_server(**kwargs):
38
- """Start the Webscout OpenAI-compatible API server (FastAPI backend)."""
39
- run_api(**kwargs)
40
- except ImportError:
41
- # Fallback for environments where the backend is not available
42
- def run_api(*args, **kwargs):
43
- raise ImportError("webscout.auth.server.run_api is not available in this environment.")
44
- def start_server(*args, **kwargs):
45
- raise ImportError("webscout.auth.server.start_server is not available in this environment.")
46
-
47
- # ---
48
- # API Documentation
49
- #
50
- # start_server
51
- # -------------
52
- # def start_server(
53
- # port: int = 8000,
54
- # host: str = "0.0.0.0",
55
- # api_key: str = None,
56
- # default_provider: str = None,
57
- # base_url: str = None,
58
- # workers: int = 1,
59
- # log_level: str = 'info',
60
- # debug: bool = False,
61
- # no_auth: bool = False,
62
- # no_rate_limit: bool = False
63
- # ):
64
- # """
65
- # Start the OpenAI-compatible API server with optional configuration.
66
- #
67
- # Parameters:
68
- # port (int, optional): The port to run the server on. Defaults to 8000.
69
- # host (str, optional): Host address to bind the server. Defaults to '0.0.0.0'.
70
- # api_key (str, optional): API key for authentication. If None, authentication is disabled.
71
- # default_provider (str, optional): The default provider to use. If None, uses the package default.
72
- # base_url (str, optional): Base URL prefix for the API (e.g., '/api/v1'). If None, no prefix is used.
73
- # workers (int, optional): Number of worker processes. Defaults to 1.
74
- # log_level (str, optional): Log level for the server ('debug', 'info', etc.). Defaults to 'info'.
75
- # debug (bool, optional): Run the server in debug mode with auto-reload. Defaults to False.
76
- # no_auth (bool, optional): Disable authentication (no API keys required). Defaults to False.
77
- # no_rate_limit (bool, optional): Disable rate limiting (unlimited requests). Defaults to False.
78
- #
79
- # Returns:
80
- # None
81
- # """
82
- #
83
- # run_api
84
- # -------
85
- # def run_api(
86
- # host: str = '0.0.0.0',
87
- # port: int = None,
88
- # api_key: str = None,
89
- # default_provider: str = None,
90
- # base_url: str = None,
91
- # debug: bool = False,
92
- # workers: int = 1,
93
- # log_level: str = 'info',
94
- # show_available_providers: bool = True,
95
- # no_auth: bool = False,
96
- # no_rate_limit: bool = False,
97
- # ) -> None:
98
- # """
99
- # Advanced server startup for the OpenAI-compatible API server.
100
- #
101
- # Parameters:
102
- # host (str, optional): Host address to bind the server. Defaults to '0.0.0.0'.
103
- # port (int, optional): Port to run the server on. Defaults to 8000 if not specified.
104
- # api_key (str, optional): API key for authentication. If None, authentication is disabled.
105
- # default_provider (str, optional): The default provider to use. If None, uses the package default.
106
- # base_url (str, optional): Base URL prefix for the API (e.g., '/api/v1'). If None, no prefix is used.
107
- # debug (bool, optional): Run the server in debug mode with auto-reload. Defaults to False.
108
- # workers (int, optional): Number of worker processes. Defaults to 1.
109
- # log_level (str, optional): Log level for the server ('debug', 'info', etc.). Defaults to 'info'.
110
- # show_available_providers (bool, optional): Print available providers on startup. Defaults to True.
111
- # no_auth (bool, optional): Disable authentication (no API keys required). Defaults to False.
112
- # no_rate_limit (bool, optional): Disable rate limiting (unlimited requests). Defaults to False.
113
- #
114
- # Returns:
115
- # None
116
- # """
1
+ """
2
+ Unified client import for OpenAI-compatible providers and server utilities.
3
+
4
+ This module provides a unified import interface for all OpenAI-compatible providers and exposes
5
+ helper functions to start the OpenAI-compatible API server programmatically.
6
+
7
+ Usage:
8
+ from webscout.client import FreeAIChat, AI4Chat, ExaChat, MultiChatAI, TwoAI, SciraChat, ChatSandbox, C4AI, Groq, TypeGPT, LLMChat, Cleeai, DeepInfra, BlackboxAI, Cloudflare, Netwrck, OIVSCode, Venice, Writecream, Wisecat, Yep, X0GPT, Sonus, Toolbaz, TextPollinations, StandardInput, Opkfc, Flowith, ExaAI, FreeGemini, GeminiAPI, Gemini, GithubChat, GizAI, Glider, HeckAI, HuggingFaceChat, Hunyuan, Jadve, Julius, Koala, LearnFast, LearnFastAI, NEMOTRON, MCPCore, PydanticImports, TeachAnything, UncovrAI, API, Base
9
+ client = FreeAIChat()
10
+ response = client.chat.completions.create(...)
11
+
12
+ # To start the server programmatically:
13
+ from webscout.client import start_server
14
+ start_server()
15
+
16
+ # For advanced server control:
17
+ from webscout.client import run_api
18
+ run_api(host="0.0.0.0", port=8000, debug=True)
19
+
20
+ # Instantly start the API server from the command line:
21
+ # python -m webscout.client
22
+ # or, if installed as a script:
23
+ # webscout-api
24
+
25
+ Exports:
26
+ - All OpenAI-compatible provider classes
27
+ - start_server (function): Start the OpenAI-compatible API server with default or custom settings.
28
+ - run_api (function): Advanced server startup with full control over host, port, and other options.
29
+ """
30
+
31
+ from webscout.Provider.OPENAI import *
32
+
33
+ # Import server utilities from the FastAPI-compatible backend
34
+ try:
35
+ # Use lazy import to avoid module execution issues
36
+ def run_api(*args, **kwargs):
37
+ """Run the Webscout OpenAI-compatible API server (FastAPI backend)."""
38
+ from webscout.auth.server import run_api as _run_api
39
+ return _run_api(*args, **kwargs)
40
+
41
+ def start_server(**kwargs):
42
+ """Start the Webscout OpenAI-compatible API server (FastAPI backend)."""
43
+ from webscout.auth.server import run_api as _run_api
44
+ return _run_api(**kwargs)
45
+ except ImportError:
46
+ # Fallback for environments where the backend is not available
47
+ def run_api(*args, **kwargs):
48
+ raise ImportError("webscout.auth.server.run_api is not available in this environment.")
49
+ def start_server(*args, **kwargs):
50
+ raise ImportError("webscout.auth.server.start_server is not available in this environment.")
51
+
52
+ # ---
53
+ # API Documentation
54
+ #
55
+ # start_server
56
+ # -------------
57
+ # def start_server(
58
+ # port: int = 8000,
59
+ # host: str = "0.0.0.0",
60
+ # api_key: str = None,
61
+ # default_provider: str = None,
62
+ # base_url: str = None,
63
+ # workers: int = 1,
64
+ # log_level: str = 'info',
65
+ # debug: bool = False,
66
+ # no_auth: bool = False,
67
+ # no_rate_limit: bool = False
68
+ # ):
69
+ # """
70
+ # Start the OpenAI-compatible API server with optional configuration.
71
+ #
72
+ # Parameters:
73
+ # port (int, optional): The port to run the server on. Defaults to 8000.
74
+ # host (str, optional): Host address to bind the server. Defaults to '0.0.0.0'.
75
+ # api_key (str, optional): API key for authentication. If None, authentication is disabled.
76
+ # default_provider (str, optional): The default provider to use. If None, uses the package default.
77
+ # base_url (str, optional): Base URL prefix for the API (e.g., '/api/v1'). If None, no prefix is used.
78
+ # workers (int, optional): Number of worker processes. Defaults to 1.
79
+ # log_level (str, optional): Log level for the server ('debug', 'info', etc.). Defaults to 'info'.
80
+ # debug (bool, optional): Run the server in debug mode with auto-reload. Defaults to False.
81
+ # no_auth (bool, optional): Disable authentication (no API keys required). Defaults to False.
82
+ # no_rate_limit (bool, optional): Disable rate limiting (unlimited requests). Defaults to False.
83
+ #
84
+ # Returns:
85
+ # None
86
+ # """
87
+ #
88
+ # run_api
89
+ # -------
90
+ # def run_api(
91
+ # host: str = '0.0.0.0',
92
+ # port: int = None,
93
+ # api_key: str = None,
94
+ # default_provider: str = None,
95
+ # base_url: str = None,
96
+ # debug: bool = False,
97
+ # workers: int = 1,
98
+ # log_level: str = 'info',
99
+ # show_available_providers: bool = True,
100
+ # no_auth: bool = False,
101
+ # no_rate_limit: bool = False,
102
+ # ) -> None:
103
+ # """
104
+ # Advanced server startup for the OpenAI-compatible API server.
105
+ #
106
+ # Parameters:
107
+ # host (str, optional): Host address to bind the server. Defaults to '0.0.0.0'.
108
+ # port (int, optional): Port to run the server on. Defaults to 8000 if not specified.
109
+ # api_key (str, optional): API key for authentication. If None, authentication is disabled.
110
+ # default_provider (str, optional): The default provider to use. If None, uses the package default.
111
+ # base_url (str, optional): Base URL prefix for the API (e.g., '/api/v1'). If None, no prefix is used.
112
+ # debug (bool, optional): Run the server in debug mode with auto-reload. Defaults to False.
113
+ # workers (int, optional): Number of worker processes. Defaults to 1.
114
+ # log_level (str, optional): Log level for the server ('debug', 'info', etc.). Defaults to 'info'.
115
+ # show_available_providers (bool, optional): Print available providers on startup. Defaults to True.
116
+ # no_auth (bool, optional): Disable authentication (no API keys required). Defaults to False.
117
+ # no_rate_limit (bool, optional): Disable rate limiting (unlimited requests). Defaults to False.
118
+ #
119
+ # Returns:
120
+ # None
121
+ # """
@@ -1,6 +1,8 @@
1
1
  # ๐Ÿ”ฅ LitAgent - The Lit User Agent Generator
2
2
 
3
- LitAgent is a powerful and modern user agent generator that keeps your requests fresh and undetectable! Built with style and packed with features, it's your go-to solution for managing user agents in your web scraping projects.
3
+ LitAgent is a powerful, modern user agent generator that keeps your requests fresh and undetectable! Built for web scraping, it helps you manage user agents with ease and style.
4
+
5
+ ---
4
6
 
5
7
  ## ๐Ÿš€ Quick Start
6
8
 
@@ -15,41 +17,46 @@ ua = agent.random()
15
17
  print(ua) # Mozilla/5.0 (Windows NT 11.0) AppleWebKit/537.36 ...
16
18
  ```
17
19
 
20
+ ---
21
+
18
22
  ## ๐ŸŽฏ Features
19
23
 
20
24
  ### Browser-Specific Agents
21
25
 
22
26
  ```python
23
27
  # Get agents for specific browsers
24
- chrome_ua = agent.chrome() # Latest Chrome agent
25
- firefox_ua = agent.firefox() # Latest Firefox agent
26
- safari_ua = agent.safari() # Latest Safari agent
27
- edge_ua = agent.edge() # Latest Edge agent
28
- opera_ua = agent.opera() # Latest Opera agent
28
+ chrome_ua = agent.chrome() # Latest Chrome agent
29
+ firefox_ua = agent.firefox() # Latest Firefox agent
30
+ safari_ua = agent.safari() # Latest Safari agent
31
+ edge_ua = agent.edge() # Latest Edge agent
32
+ opera_ua = agent.opera() # Latest Opera agent
29
33
  ```
30
34
 
31
35
  ### Device-Specific Agents
32
36
 
33
37
  ```python
34
38
  # Get mobile or desktop agents
35
- mobile_ua = agent.mobile() # Mobile device agent
36
- desktop_ua = agent.desktop() # Desktop device agent
39
+ mobile_ua = agent.mobile() # Mobile device agent
40
+ desktop_ua = agent.desktop() # Desktop device agent
37
41
 
38
42
  # New - Get agents for specific device types
39
- tablet_ua = agent.tablet() # Tablet device agent
40
- tv_ua = agent.smart_tv() # Smart TV agent
41
- console_ua = agent.gaming() # Gaming console agent
43
+ tablet_ua = agent.tablet() # Tablet device agent
44
+ tv_ua = agent.smart_tv() # Smart TV agent
45
+ console_ua = agent.gaming() # Gaming console agent
46
+
47
+ # Wearable device user agent support
48
+ wearable_ua = agent.wearable() # Get a wearable device user agent
42
49
  ```
43
50
 
44
51
  ### OS-Specific Agents
45
52
 
46
53
  ```python
47
54
  # New - Get agents for specific operating systems
48
- windows_ua = agent.windows() # Windows agent
49
- mac_ua = agent.macos() # macOS agent
50
- linux_ua = agent.linux() # Linux agent
51
- android_ua = agent.android() # Android agent
52
- ios_ua = agent.ios() # iOS agent
55
+ windows_ua = agent.windows() # Windows agent
56
+ mac_ua = agent.macos() # macOS agent
57
+ linux_ua = agent.linux() # Linux agent`
58
+ android_ua = agent.android() # Android agent
59
+ ios_ua = agent.ios() # iOS agent
53
60
  ```
54
61
 
55
62
  ### Custom Agent Generation
@@ -83,6 +90,15 @@ ip = agent.rotate_ip()
83
90
  print(ip) # 192.168.1.10 (example)
84
91
  ```
85
92
 
93
+ ### Proxy Pool & Rotation
94
+
95
+ ```python
96
+ agent.set_proxy_pool(["http://proxy1:8080", "http://proxy2:8080"])
97
+ proxy = agent.rotate_proxy() # Get next proxy from pool
98
+ ```
99
+
100
+ ---
101
+
86
102
  ## ๐Ÿ’ซ Real-World Examples
87
103
 
88
104
  ### With Requests
@@ -152,47 +168,30 @@ driver = create_driver()
152
168
  driver.get('https://example.com')
153
169
  ```
154
170
 
155
- ### New - With Playwright
156
-
157
- ```python
158
- from playwright.sync_api import sync_playwright
159
- from webscout import LitAgent
160
-
161
- agent = LitAgent()
162
-
163
- def browse_with_playwright():
164
- with sync_playwright() as p:
165
- browser_options = {
166
- "user_agent": agent.chrome(),
167
- "viewport": {"width": 1280, "height": 720}
168
- }
169
- browser = p.chromium.launch()
170
- context = browser.new_context(**browser_options)
171
- page = context.new_page()
172
- page.goto('https://example.com')
173
- # Continue with your scraping logic
174
- browser.close()
175
- ```
171
+ ---
176
172
 
177
173
  ## ๐ŸŒŸ Pro Tips
178
174
 
179
- 1. **Rotate Agents**: Refresh your agents pool periodically to avoid detection
175
+ 1. **Rotate Agents Regularly**
176
+ Refresh your agent pool periodically to avoid detection.
177
+
180
178
  ```python
181
179
  agent = LitAgent()
182
- for _ in range(10):
180
+ for i in range(10):
183
181
  response = requests.get(url, headers={'User-Agent': agent.random()})
184
- if _ % 3 == 0: # Refresh every 3 requests
182
+ if i % 3 == 0:
185
183
  agent.refresh()
186
184
  ```
187
185
 
188
- 2. **Device-Specific Scraping**: Use appropriate agents for different platforms
186
+ 2. **Device-Specific Scraping**
187
+ Use device-specific agents for different platforms.
188
+
189
189
  ```python
190
190
  # Mobile site scraping
191
191
  mobile_response = requests.get(
192
192
  'https://m.example.com',
193
193
  headers={'User-Agent': agent.mobile()}
194
194
  )
195
-
196
195
  # Desktop site scraping
197
196
  desktop_response = requests.get(
198
197
  'https://example.com',
@@ -200,7 +199,9 @@ def browse_with_playwright():
200
199
  )
201
200
  ```
202
201
 
203
- 3. **Browser Consistency**: Stick to one browser type per session
202
+ 3. **Browser Consistency**
203
+ Stick to one browser type per session for realism.
204
+
204
205
  ```python
205
206
  chrome_agent = agent.chrome()
206
207
  headers = {
@@ -210,11 +211,11 @@ def browse_with_playwright():
210
211
  # Use these headers for all requests in this session
211
212
  ```
212
213
 
213
- 4. **New - Browser Fingerprinting & IP Rotation**:
214
+ 4. **Browser Fingerprinting & IP Rotation**
215
+ Generate consistent browser fingerprints and rotate IPs.
216
+
214
217
  ```python
215
- # Create consistent browser fingerprinting
216
218
  fingerprint = agent.generate_fingerprint(browser="chrome")
217
-
218
219
  headers = {
219
220
  'User-Agent': fingerprint['user_agent'],
220
221
  'Accept-Language': fingerprint['accept_language'],
@@ -223,33 +224,37 @@ def browse_with_playwright():
223
224
  'Sec-Ch-Ua-Platform': fingerprint['platform'],
224
225
  'X-Forwarded-For': fingerprint['x-forwarded-for']
225
226
  }
226
-
227
- # Use this consistent set for all session requests while rotating IPs
228
227
  ```
229
228
 
230
- 5. **New - Multi-threading Support**:
229
+ 5. **Multi-threading Support**
230
+ Use thread-safe mode for concurrent requests.
231
+
231
232
  ```python
232
233
  import concurrent.futures
233
234
  from webscout import LitAgent
234
-
235
- agent = LitAgent(thread_safe=True) # Thread-safe instance
236
-
235
+ import requests
236
+
237
+ agent = LitAgent(thread_safe=True)
238
+
237
239
  def fetch_url(url):
238
240
  headers = {'User-Agent': agent.random()}
239
241
  return requests.get(url, headers=headers).text
240
-
242
+
241
243
  urls = ['https://example1.com', 'https://example2.com', 'https://example3.com']
242
-
243
244
  with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
244
245
  results = list(executor.map(fetch_url, urls))
245
246
  ```
246
247
 
248
+ ---
249
+
247
250
  ## ๐Ÿ”ง Supported Browsers & Devices
248
251
 
249
252
  - **Browsers**: Chrome, Firefox, Safari, Edge, Opera, Brave, Vivaldi
250
253
  - **Operating Systems**: Windows, macOS, Linux, Android, iOS, Chrome OS
251
254
  - **Devices**: Mobile phones, Tablets, Desktops, Game consoles, Smart TVs, Wearables
252
255
 
256
+ ---
257
+
253
258
  ## ๐ŸŽจ Why LitAgent?
254
259
 
255
260
  - ๐Ÿš€ Modern and up-to-date user agents
@@ -263,7 +268,11 @@ def browse_with_playwright():
263
268
  - ๐Ÿงต Thread-safe operation
264
269
  - ๐Ÿ•ฐ๏ธ Automatic refresh scheduling
265
270
 
266
- ## ๐Ÿ“Š New - Analytics and Reporting
271
+ ---
272
+
273
+ ## ๐Ÿ“Š Analytics and Reporting
274
+
275
+ Get statistics on your agent usage and export your data.
267
276
 
268
277
  ```python
269
278
  # Get statistics on your agent usage
@@ -276,10 +285,14 @@ print(f"Detection avoidance rate: {stats.avoidance_rate}%")
276
285
  agent.export_stats('agent_usage.json')
277
286
  ```
278
287
 
288
+ ---
289
+
279
290
  ## ๐Ÿ“‹ Installation
280
291
 
281
292
  ```bash
282
293
  pip install webscout
283
294
  ```
284
295
 
296
+ ---
297
+
285
298
  Made with ๐Ÿ’– by the HelpingAI team
@@ -93,15 +93,23 @@ class LitAgent:
93
93
  self._stats["device_usage"][device_type] = self._stats["device_usage"].get(device_type, 0) + 1
94
94
 
95
95
  def random(self) -> str:
96
- """Get a random user agent! ๐ŸŽฒ"""
96
+ """Get a random user agent! ๐ŸŽฒ (with blacklist/whitelist support)"""
97
+ if hasattr(self, '_whitelist') and self._whitelist:
98
+ pool = list(self._whitelist)
99
+ else:
100
+ pool = [a for a in self.agents if not hasattr(self, '_blacklist') or a not in self._blacklist]
101
+ if not pool:
102
+ pool = self.agents
97
103
  if self.thread_safe and self.lock:
98
104
  with self.lock:
99
- agent = random.choice(self.agents)
105
+ agent = random.choice(pool)
100
106
  self._update_stats()
107
+ self._add_to_history(agent)
101
108
  return agent
102
109
  else:
103
- agent = random.choice(self.agents)
110
+ agent = random.choice(pool)
104
111
  self._update_stats()
112
+ self._add_to_history(agent)
105
113
  return agent
106
114
 
107
115
  def browser(self, name: str) -> str:
@@ -330,7 +338,8 @@ class LitAgent:
330
338
  self._update_stats(browser_type=browser, device_type=device_type)
331
339
  return agent
332
340
 
333
- def generate_fingerprint(self, browser: Optional[str] = None) -> Dict[str, str]:
341
+ @staticmethod
342
+ def generate_fingerprint(browser: Optional[str] = None) -> Dict[str, str]:
334
343
  """
335
344
  Generate a consistent browser fingerprint for anti-fingerprinting purposes.
336
345
 
@@ -347,13 +356,14 @@ class LitAgent:
347
356
  Dict[str, str]: A dictionary containing fingerprinting headers and values.
348
357
  """
349
358
  # Get a random user agent using the random() method
350
- user_agent = self.random()
359
+ agent = LitAgent()
360
+ user_agent = agent.random()
351
361
 
352
362
  # If browser is specified, try to get a matching one
353
363
  if browser:
354
364
  browser = browser.lower()
355
365
  if browser in BROWSERS:
356
- user_agent = self.browser(browser)
366
+ user_agent = agent.browser(browser)
357
367
 
358
368
  accept_language = random.choice(FINGERPRINTS["accept_language"])
359
369
  accept = random.choice(FINGERPRINTS["accept"])
@@ -367,7 +377,7 @@ class LitAgent:
367
377
  sec_ch_ua = FINGERPRINTS["sec_ch_ua"][browser_name].format(version, version)
368
378
  break
369
379
 
370
- ip = self.rotate_ip()
380
+ ip = agent.rotate_ip()
371
381
  fingerprint = {
372
382
  "user_agent": user_agent,
373
383
  "accept_language": accept_language,
@@ -379,10 +389,10 @@ class LitAgent:
379
389
  "x-client-ip": ip,
380
390
  "forwarded": f"for={ip};proto=https",
381
391
  "x-forwarded-proto": "https",
382
- "x-request-id": self.random_id(8) if hasattr(self, 'random_id') else ''.join(random.choices('0123456789abcdef', k=8)),
392
+ "x-request-id": agent.random_id(8) if hasattr(agent, 'random_id') else ''.join(random.choices('0123456789abcdef', k=8)),
383
393
  }
384
394
 
385
- self._update_stats(browser_type=browser)
395
+ agent._update_stats(browser_type=browser)
386
396
  return fingerprint
387
397
 
388
398
  def refresh(self) -> None:
@@ -472,6 +482,63 @@ class LitAgent:
472
482
  """Generate a random identifier string."""
473
483
  return ''.join(random.choices('0123456789abcdef', k=length)).lower()
474
484
 
485
+ def wearable(self) -> str:
486
+ """Get a wearable device agent! โŒš"""
487
+ wearable_type = random.choice(DEVICES['wearable'])
488
+ # Example user agent for wearables (simplified)
489
+ if 'Apple Watch' in wearable_type:
490
+ agent = f"Mozilla/5.0 (AppleWatch; CPU WatchOS like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/9.0 Mobile/13S344 Safari/602.1"
491
+ elif 'Samsung' in wearable_type:
492
+ agent = f"Mozilla/5.0 (Linux; Tizen 3.0; {wearable_type}) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/1.0"
493
+ elif 'Fitbit' in wearable_type:
494
+ agent = f"Mozilla/5.0 (Linux; {wearable_type}) AppleWebKit/537.36 (KHTML, like Gecko)"
495
+ elif 'Garmin' in wearable_type:
496
+ agent = f"Mozilla/5.0 (Linux; {wearable_type}) AppleWebKit/537.36 (KHTML, like Gecko)"
497
+ else:
498
+ agent = self.random()
499
+ self._update_stats(device_type="wearable")
500
+ return agent
501
+
502
+ def set_proxy_pool(self, proxies: List[str]):
503
+ """Set a pool of proxies for rotation."""
504
+ self._proxy_pool = proxies
505
+ self._proxy_index = 0
506
+
507
+ def rotate_proxy(self) -> Optional[str]:
508
+ """Rotate through the proxy pool and return the next proxy."""
509
+ if not hasattr(self, '_proxy_pool') or not self._proxy_pool:
510
+ return None
511
+ proxy = self._proxy_pool[self._proxy_index]
512
+ self._proxy_index = (self._proxy_index + 1) % len(self._proxy_pool)
513
+ return proxy
514
+
515
+ def add_to_blacklist(self, agent: str):
516
+ """Add a user agent to the blacklist."""
517
+ if not hasattr(self, '_blacklist'):
518
+ self._blacklist = set()
519
+ self._blacklist.add(agent)
520
+
521
+ def add_to_whitelist(self, agent: str):
522
+ """Add a user agent to the whitelist."""
523
+ if not hasattr(self, '_whitelist'):
524
+ self._whitelist = set()
525
+ self._whitelist.add(agent)
526
+
527
+ def _add_to_history(self, agent: str):
528
+ if not hasattr(self, '_history'):
529
+ self._history = []
530
+ self._history.append(agent)
531
+ if len(self._history) > 50:
532
+ self._history.pop(0)
533
+
534
+ def get_history(self) -> List[str]:
535
+ """Get the last 50 user agents served."""
536
+ return getattr(self, '_history', [])
537
+
538
+ def validate_agent(self, agent: str) -> bool:
539
+ """Validate if a user agent string is realistic (basic check)."""
540
+ return agent.startswith("Mozilla/5.0") and any(b in agent for b in BROWSERS.keys())
541
+
475
542
  if __name__ == "__main__":
476
543
  # Test it out! ๐Ÿงช
477
544
  agent = LitAgent()
@@ -484,9 +551,32 @@ if __name__ == "__main__":
484
551
  print("Tablet:", agent.tablet())
485
552
  print("Smart TV:", agent.smart_tv())
486
553
  print("Gaming:", agent.gaming())
554
+ print("Wearable:", agent.wearable())
487
555
 
488
556
  # Test custom agent
489
557
  print("Custom:", agent.custom(browser="chrome", os="windows", os_version="10.0"))
490
558
 
491
559
  # Test fingerprinting
492
560
  print("Fingerprint:", agent.generate_fingerprint("chrome"))
561
+
562
+ # Test proxy rotation
563
+ agent.set_proxy_pool(["http://proxy1.com", "http://proxy2.com"])
564
+ print("Proxy 1:", agent.rotate_proxy())
565
+ print("Proxy 2:", agent.rotate_proxy())
566
+
567
+ # Test blacklist/whitelist
568
+ agent.add_to_blacklist("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36")
569
+ agent.add_to_whitelist("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
570
+ print("Blacklisted:", agent.random())
571
+ print("Whitelisted:", agent.random())
572
+
573
+ # Test agent history
574
+ for _ in range(55):
575
+ agent.random()
576
+ print("History:", agent.get_history())
577
+
578
+ # Test agent validation
579
+ print("Valid agent:", agent.validate_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"))
580
+ print("Invalid agent:", agent.validate_agent("InvalidUserAgentString"))
581
+ ip = agent.rotate_ip()
582
+ print(ip) # 192.168.1.10 (example)
webscout/version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "8.3.2"
1
+ __version__ = "8.3.4"
2
2
  __prog__ = "webscout"