fastweb-sdk 0.1.1__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Bani Montoya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastweb-sdk
3
+ Version: 0.1.1
4
+ Summary: Python SDK for FastWeb Agentic Browser Engine - Requires explicit binary installation
5
+ Author-email: Bani Montoya <banimontoya@gmail.com>
6
+ License-Expression: MIT OR Apache-2.0
7
+ Project-URL: Homepage, https://github.com/B4N1-com/fastweb
8
+ Project-URL: Repository, https://github.com/B4N1-com/fastweb
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Topic :: Internet :: WWW/HTTP
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: requests>=2.28.0
22
+ Dynamic: license-file
23
+
24
+ # FastWeb Python SDK
25
+
26
+ Python bindings for FastWeb: The Agentic Browser Engine.
27
+
28
+ ## Installation
29
+
30
+ ### 1. Install the FastWeb Binary
31
+
32
+ ```bash
33
+ curl -sL https://fastweb.b4n1.com/install | bash
34
+ ```
35
+
36
+ ### 2. Install the Python SDK
37
+
38
+ ```bash
39
+ pip install fastweb-sdk
40
+ ```
41
+
42
+ On Ubuntu 23.04+ or other externally-managed environments, use a virtual environment:
43
+
44
+ ```bash
45
+ python3 -m venv .venv && source .venv/bin/activate
46
+ pip install fastweb-sdk
47
+ ```
48
+
49
+ Or with pipx:
50
+
51
+ ```bash
52
+ pipx install fastweb-sdk
53
+ ```
54
+
55
+ ## Quick Start
56
+
57
+ ```python
58
+ from fastweb import BrowserMode, AgentBrowser
59
+
60
+ # Create a browser instance
61
+ browser = AgentBrowser(mode=BrowserMode.LIGHT)
62
+
63
+ # Navigate to a page
64
+ page = browser.goto("https://example.com")
65
+
66
+ # Access structured data
67
+ print("Page content:")
68
+ print(page.markdown)
69
+
70
+ print(f"Found {len(page.links)} links")
71
+ print("First 5 links:", page.links[:5])
72
+
73
+ # Extract main content
74
+ main_content = page.get_main_content()
75
+ print("Main content preview:", main_content[:200] + "...")
76
+
77
+ # Find specific links
78
+ github_links = page.find_links_by_text("github")
79
+ print("GitHub links:", github_links)
80
+
81
+ # Close browser when done
82
+ browser.close()
83
+ ```
84
+
85
+ ## Browser Modes
86
+
87
+ ### Light Mode (Default)
88
+
89
+ - **Use case**: Reading articles, scraping static content, extracting links
90
+ - **Performance**: < 15MB RAM, instant startup
91
+ - **Capabilities**: HTML parsing, markdown conversion, link extraction
92
+ - **Limitations**: No JavaScript execution
93
+
94
+ ```python
95
+ browser = AgentBrowser(mode=BrowserMode.LIGHT)
96
+ ```
97
+
98
+ ### Render Mode
99
+
100
+ - **Use case**: SPAs, form filling, visual verification
101
+ - **Performance**: Higher memory usage, slower startup
102
+ - **Capabilities**: Full JavaScript execution, screenshots, interaction
103
+
104
+ ```python
105
+ browser = AgentBrowser(mode=BrowserMode.RENDER)
106
+ ```
107
+
108
+ ## API Reference
109
+
110
+ ### AgentBrowser
111
+
112
+ Main browser class for web automation.
113
+
114
+ #### Methods
115
+
116
+ - `goto(url: str) -> Page`: Navigate to URL and return structured page data
117
+ - `close()`: Close the browser session
118
+
119
+ #### Parameters
120
+
121
+ - `mode`: BrowserMode.LIGHT or BrowserMode.RENDER
122
+ - `timeout`: Request timeout in seconds (default: 30)
123
+ - `user_agent`: Custom user agent string
124
+
125
+ ### Page
126
+
127
+ Structured data from a web page.
128
+
129
+ #### Attributes
130
+
131
+ - `url: str`: The page URL
132
+ - `markdown: str`: Clean markdown content
133
+ - `links: List[str]`: Extracted links
134
+ - `screenshot: Optional[str]`: Base64-encoded screenshot (render mode only)
135
+
136
+ #### Methods
137
+
138
+ - `get_main_content() -> str`: Extract main content, skipping headers/footers
139
+ - `find_links_by_text(text: str) -> List[str]`: Find links containing specific text
140
+
141
+ ## Context Manager
142
+
143
+ Use the browser as a context manager for automatic cleanup:
144
+
145
+ ```python
146
+ from fastweb import BrowserMode, AgentBrowser
147
+
148
+ with AgentBrowser(mode=BrowserMode.LIGHT) as browser:
149
+ page = browser.goto("https://example.com")
150
+ print(page.markdown)
151
+ # Browser automatically closed
152
+ ```
153
+
154
+ ## Security
155
+
156
+ - All HTTP requests use TLS
157
+ - No arbitrary code execution
158
+ - Input validation and sanitization
159
+ - **Explicit Installation**: Binary must be installed separately via `curl -sL https://fastweb.b4n1.com/install | bash` — no automatic downloads
160
+
161
+ ## License
162
+
163
+ MIT OR Apache-2.0
@@ -0,0 +1,140 @@
1
+ # FastWeb Python SDK
2
+
3
+ Python bindings for FastWeb: The Agentic Browser Engine.
4
+
5
+ ## Installation
6
+
7
+ ### 1. Install the FastWeb Binary
8
+
9
+ ```bash
10
+ curl -sL https://fastweb.b4n1.com/install | bash
11
+ ```
12
+
13
+ ### 2. Install the Python SDK
14
+
15
+ ```bash
16
+ pip install fastweb-sdk
17
+ ```
18
+
19
+ On Ubuntu 23.04+ or other externally-managed environments, use a virtual environment:
20
+
21
+ ```bash
22
+ python3 -m venv .venv && source .venv/bin/activate
23
+ pip install fastweb-sdk
24
+ ```
25
+
26
+ Or with pipx:
27
+
28
+ ```bash
29
+ pipx install fastweb-sdk
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```python
35
+ from fastweb import BrowserMode, AgentBrowser
36
+
37
+ # Create a browser instance
38
+ browser = AgentBrowser(mode=BrowserMode.LIGHT)
39
+
40
+ # Navigate to a page
41
+ page = browser.goto("https://example.com")
42
+
43
+ # Access structured data
44
+ print("Page content:")
45
+ print(page.markdown)
46
+
47
+ print(f"Found {len(page.links)} links")
48
+ print("First 5 links:", page.links[:5])
49
+
50
+ # Extract main content
51
+ main_content = page.get_main_content()
52
+ print("Main content preview:", main_content[:200] + "...")
53
+
54
+ # Find specific links
55
+ github_links = page.find_links_by_text("github")
56
+ print("GitHub links:", github_links)
57
+
58
+ # Close browser when done
59
+ browser.close()
60
+ ```
61
+
62
+ ## Browser Modes
63
+
64
+ ### Light Mode (Default)
65
+
66
+ - **Use case**: Reading articles, scraping static content, extracting links
67
+ - **Performance**: < 15MB RAM, instant startup
68
+ - **Capabilities**: HTML parsing, markdown conversion, link extraction
69
+ - **Limitations**: No JavaScript execution
70
+
71
+ ```python
72
+ browser = AgentBrowser(mode=BrowserMode.LIGHT)
73
+ ```
74
+
75
+ ### Render Mode
76
+
77
+ - **Use case**: SPAs, form filling, visual verification
78
+ - **Performance**: Higher memory usage, slower startup
79
+ - **Capabilities**: Full JavaScript execution, screenshots, interaction
80
+
81
+ ```python
82
+ browser = AgentBrowser(mode=BrowserMode.RENDER)
83
+ ```
84
+
85
+ ## API Reference
86
+
87
+ ### AgentBrowser
88
+
89
+ Main browser class for web automation.
90
+
91
+ #### Methods
92
+
93
+ - `goto(url: str) -> Page`: Navigate to URL and return structured page data
94
+ - `close()`: Close the browser session
95
+
96
+ #### Parameters
97
+
98
+ - `mode`: BrowserMode.LIGHT or BrowserMode.RENDER
99
+ - `timeout`: Request timeout in seconds (default: 30)
100
+ - `user_agent`: Custom user agent string
101
+
102
+ ### Page
103
+
104
+ Structured data from a web page.
105
+
106
+ #### Attributes
107
+
108
+ - `url: str`: The page URL
109
+ - `markdown: str`: Clean markdown content
110
+ - `links: List[str]`: Extracted links
111
+ - `screenshot: Optional[str]`: Base64-encoded screenshot (render mode only)
112
+
113
+ #### Methods
114
+
115
+ - `get_main_content() -> str`: Extract main content, skipping headers/footers
116
+ - `find_links_by_text(text: str) -> List[str]`: Find links containing specific text
117
+
118
+ ## Context Manager
119
+
120
+ Use the browser as a context manager for automatic cleanup:
121
+
122
+ ```python
123
+ from fastweb import BrowserMode, AgentBrowser
124
+
125
+ with AgentBrowser(mode=BrowserMode.LIGHT) as browser:
126
+ page = browser.goto("https://example.com")
127
+ print(page.markdown)
128
+ # Browser automatically closed
129
+ ```
130
+
131
+ ## Security
132
+
133
+ - All HTTP requests use TLS
134
+ - No arbitrary code execution
135
+ - Input validation and sanitization
136
+ - **Explicit Installation**: Binary must be installed separately via `curl -sL https://fastweb.b4n1.com/install | bash` — no automatic downloads
137
+
138
+ ## License
139
+
140
+ MIT OR Apache-2.0
@@ -0,0 +1,19 @@
1
+ """
2
+ FastWeb Python SDK
3
+ Zero-overhead, high-speed web execution for sovereign AI agents.
4
+
5
+ NOTE: The FastWeb binary must be installed separately via:
6
+ python -m fastweb install
7
+
8
+ Or manually:
9
+ curl -sL https://fastweb.b4n1.com/install | bash
10
+ """
11
+
12
+ from .browser import AgentBrowser, BrowserMode, Page
13
+ from .errors import BinaryNotFoundError
14
+
15
+ __version__ = "0.1.0"
16
+ __author__ = "Bani Montoya"
17
+ __email__ = "banimontoya@gmail.com"
18
+
19
+ __all__ = ["AgentBrowser", "BrowserMode", "Page", "BinaryNotFoundError"]
@@ -0,0 +1,141 @@
1
+ """
2
+ FastWeb CLI Entry Point
3
+ """
4
+
5
+ import os
6
+ import sys
7
+ import tempfile
8
+ from pathlib import Path
9
+
10
+
11
+ def install_command():
12
+ """Handle the 'python -m fastweb install' command."""
13
+ from .browser import get_fastweb_binary, get_fastweb_version
14
+
15
+ # Check if already installed
16
+ existing = get_fastweb_binary()
17
+ if existing:
18
+ version = get_fastweb_version()
19
+ print(f"FastWeb already installed at: {existing}")
20
+ print(f"Version: {version}")
21
+ response = input("Reinstall? (y/N): ").lower().strip()
22
+ if response not in ("y", "yes"):
23
+ print("Installation cancelled.")
24
+ return
25
+
26
+ # Determine install location
27
+ if os.access("/usr/local/bin", os.W_OK):
28
+ install_dir = Path("/usr/local/bin")
29
+ use_sudo = False
30
+ elif os.access(str(Path.home() / ".local/bin"), os.W_OK):
31
+ install_dir = Path.home() / ".local/bin"
32
+ use_sudo = False
33
+ else:
34
+ install_dir = Path.home() / ".fastweb" / "bin"
35
+ use_sudo = False # User directory, no sudo needed
36
+
37
+ install_dir.mkdir(parents=True, exist_ok=True)
38
+ binary_path = install_dir / "fastweb"
39
+
40
+ # Download binary
41
+ version_url = "https://fastweb.b4n1.com/latest-version"
42
+ print(f"\nChecking latest version...")
43
+
44
+ try:
45
+ import requests
46
+
47
+ resp = requests.get(version_url, timeout=10)
48
+ version_info = resp.json()
49
+ download_url = version_info.get("url")
50
+ version = version_info.get("version", "unknown")
51
+ print(f"Latest version: {version}")
52
+ print(f"Downloading from: {download_url}")
53
+ except Exception as e:
54
+ print(f"Error getting version info: {e}")
55
+ sys.exit(1)
56
+
57
+ print(f"\nDownloading FastWeb {version}...")
58
+ try:
59
+ resp = requests.get(download_url, timeout=60)
60
+ resp.raise_for_status()
61
+
62
+ import tarfile
63
+
64
+ with tempfile.NamedTemporaryFile(suffix=".tar.gz", delete=False) as tmp_tar:
65
+ tmp_tar.write(resp.content)
66
+ tmp_tar_path = tmp_tar.name
67
+
68
+ try:
69
+ # Extract and install binary
70
+ with tarfile.open(tmp_tar_path, "r:gz") as tar:
71
+ # Find the binary in the tar
72
+ for member in tar.getmembers():
73
+ if member.isfile() and member.name.endswith(
74
+ "/fastweb-v0.1.0-x86_64"
75
+ ):
76
+ # Extract the binary
77
+ binary_data = tar.extractfile(member)
78
+ if binary_data:
79
+ with open(binary_path, "wb") as f:
80
+ f.write(binary_data.read())
81
+ break
82
+ else:
83
+ # Fallback: look for any executable
84
+ for member in tar.getmembers():
85
+ if member.isfile():
86
+ binary_data = tar.extractfile(member)
87
+ if binary_data:
88
+ with open(binary_path, "wb") as f:
89
+ f.write(binary_data.read())
90
+ break
91
+
92
+ # Make executable
93
+ if use_sudo:
94
+ import subprocess
95
+
96
+ subprocess.run(["chmod", "+x", str(binary_path)], check=True)
97
+ if str(binary_path).startswith("/usr/local/bin") or str(
98
+ binary_path
99
+ ).startswith("/usr/bin"):
100
+ subprocess.run(
101
+ ["sudo", "chmod", "+x", str(binary_path)], check=True
102
+ )
103
+ else:
104
+ os.chmod(binary_path, 0o755)
105
+
106
+ # Verify installation
107
+ installed_version = get_fastweb_version()
108
+ print(f"✓ FastWeb {installed_version} installed to: {binary_path}")
109
+
110
+ if not use_sudo:
111
+ # Add to PATH instructions
112
+ rc_file = Path.home() / (
113
+ ".bashrc"
114
+ if os.environ.get("SHELL", "").endswith("bash")
115
+ else ".zshrc"
116
+ )
117
+ path_line = f'export PATH="{install_dir}:$PATH"'
118
+ if rc_file.exists():
119
+ content = rc_file.read_text()
120
+ if path_line not in content:
121
+ print(f"\nTo use FastWeb, add this to your {rc_file.name}:")
122
+ print(f" {path_line}")
123
+ else:
124
+ print(
125
+ f"\nTo use FastWeb, add this to your shell rc file (~/.bashrc or ~/.zshrc):"
126
+ )
127
+ print(f" {path_line}")
128
+
129
+ finally:
130
+ try:
131
+ os.unlink(tmp_tar_path)
132
+ except:
133
+ pass
134
+
135
+ except Exception as e:
136
+ print(f"Error installing FastWeb: {e}")
137
+ sys.exit(1)
138
+
139
+
140
+ if __name__ == "__main__":
141
+ install_command()
@@ -0,0 +1,186 @@
1
+ """
2
+ FastWeb Python SDK - Browser automation for AI agents
3
+
4
+ This module provides a Python interface to the FastWeb Rust engine.
5
+ The FastWeb binary must be installed separately via: python -m fastweb install
6
+ """
7
+
8
+ import ast
9
+ import json
10
+ import os
11
+ import subprocess
12
+ import sys
13
+ from dataclasses import dataclass
14
+ from enum import Enum
15
+ from typing import List, Optional
16
+ import requests
17
+
18
+ # Use system CA certificates instead of certifi bundle
19
+ os.environ.setdefault("REQUESTS_CA_BUNDLE", "/etc/ssl/certs/ca-certificates.crt")
20
+ os.environ.setdefault("SSL_CERT_FILE", "/etc/ssl/certs/ca-certificates.crt")
21
+
22
+
23
+ class BrowserMode(Enum):
24
+ """Browser execution modes."""
25
+
26
+ LIGHT = "light"
27
+ RENDER = "render"
28
+
29
+
30
+ @dataclass
31
+ class Page:
32
+ """Structured page data returned by FastWeb."""
33
+
34
+ url: str
35
+ markdown: str
36
+ links: List[str]
37
+ screenshot: Optional[str] = None
38
+
39
+ def get_main_content(self) -> str:
40
+ """Extract main content from markdown."""
41
+ lines = self.markdown.split("\n")
42
+ content_lines = lines[2:] if len(lines) > 2 else lines
43
+ return "\n".join(content_lines).strip()
44
+
45
+ def find_links_by_text(self, text: str) -> List[str]:
46
+ """Find links containing specific text."""
47
+ return [link for link in self.links if text.lower() in link.lower()]
48
+
49
+
50
+ def get_fastweb_binary() -> Optional[str]:
51
+ """Find fastweb binary in common install locations."""
52
+ import os
53
+ from pathlib import Path
54
+ import shutil
55
+
56
+ # Check standard locations where the install script puts it
57
+ possible_locations = [
58
+ "/usr/local/bin/fastweb",
59
+ "/usr/bin/fastweb",
60
+ str(Path.home() / ".local/bin/fastweb"),
61
+ str(Path.home() / ".fastweb/bin/fastweb"),
62
+ ]
63
+
64
+ for loc in possible_locations:
65
+ if os.path.isfile(loc) and os.access(loc, os.X_OK):
66
+ return loc
67
+
68
+ return None
69
+
70
+
71
+ from .errors import BinaryNotFoundError
72
+
73
+
74
+ class AgentBrowser:
75
+ """
76
+ FastWeb Agent Browser
77
+
78
+ A browser instance optimized for AI agent workflows.
79
+ Requires FastWeb binary to be installed via: python -m fastweb install
80
+
81
+ Example:
82
+ >>> browser = AgentBrowser(mode=BrowserMode.LIGHT)
83
+ >>> page = browser.goto("https://example.com")
84
+ >>> print(page.markdown)
85
+ """
86
+
87
+ def __init__(
88
+ self,
89
+ mode: BrowserMode = BrowserMode.LIGHT,
90
+ timeout: int = 30,
91
+ user_agent: str = "FastWeb-Agent/1.0",
92
+ ):
93
+ self.mode = mode
94
+ self.timeout = timeout
95
+ self.user_agent = user_agent
96
+ self.session = requests.Session()
97
+ self.session.verify = "/etc/ssl/certs/ca-certificates.crt"
98
+ self.session.headers.update(
99
+ {
100
+ "User-Agent": user_agent,
101
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
102
+ "Accept-Language": "en-US,en;q=0.5",
103
+ "Accept-Encoding": "gzip, deflate",
104
+ "DNT": "1",
105
+ "Connection": "keep-alive",
106
+ "Upgrade-Insecure-Requests": "1",
107
+ }
108
+ )
109
+ # Verify binary is available - will raise BinaryNotFoundError if not found
110
+ from .errors import BinaryNotFoundError
111
+
112
+ binary_path = get_fastweb_binary()
113
+ if not binary_path:
114
+ raise BinaryNotFoundError()
115
+
116
+ @property
117
+ def binary_path(self) -> str:
118
+ """Get fastweb binary path."""
119
+ binary_path = get_fastweb_binary()
120
+ if not binary_path:
121
+ from .errors import BinaryNotFoundError
122
+
123
+ raise BinaryNotFoundError()
124
+ return binary_path
125
+
126
+ def goto(self, url: str) -> Page:
127
+ """Navigate to a URL and extract structured content using the Rust binary."""
128
+ try:
129
+ result = subprocess.run(
130
+ [self.binary_path, "goto", url, "--mode", self.mode.value],
131
+ capture_output=True,
132
+ text=True,
133
+ timeout=self.timeout,
134
+ )
135
+
136
+ if result.returncode != 0:
137
+ raise RuntimeError(f"Binary error: {result.stderr.strip()}")
138
+
139
+ return self._parse_output(url, result.stdout)
140
+
141
+ except subprocess.TimeoutExpired:
142
+ raise RuntimeError(f"Binary timed out after {self.timeout}s")
143
+
144
+ def _parse_output(self, url: str, output: str) -> Page:
145
+ """Parse text output from the Rust binary."""
146
+ markdown = ""
147
+ links = []
148
+
149
+ for line in output.splitlines():
150
+ if line.startswith("URL:"):
151
+ continue
152
+ elif line.startswith("Markdown:"):
153
+ continue
154
+ elif line.startswith("Links:"):
155
+ try:
156
+ links = ast.literal_eval(line[6:].strip())
157
+ except (ValueError, SyntaxError):
158
+ links = []
159
+ else:
160
+ markdown += line + "\n"
161
+
162
+ return Page(
163
+ url=url,
164
+ markdown=markdown.strip(),
165
+ links=links,
166
+ )
167
+
168
+ def close(self):
169
+ """Close the browser session."""
170
+ self.session.close()
171
+
172
+
173
+ def get_fastweb_version() -> str:
174
+ """Get FastWeb binary version."""
175
+ try:
176
+ result = subprocess.run(
177
+ [get_fastweb_binary(), "--version"],
178
+ capture_output=True,
179
+ text=True,
180
+ timeout=5,
181
+ )
182
+ if result.returncode == 0:
183
+ return result.stdout.strip()
184
+ except Exception:
185
+ pass
186
+ return "unknown"
@@ -0,0 +1,15 @@
1
+ """
2
+ FastWeb SDK Exceptions
3
+ """
4
+
5
+
6
+ class BinaryNotFoundError(RuntimeError):
7
+ """Raised when FastWeb binary is not found."""
8
+
9
+ def __init__(self):
10
+ super().__init__(
11
+ "FastWeb binary not found. Please install it first:\n"
12
+ " python -m fastweb install\n"
13
+ "Or manually:\n"
14
+ " curl -sL https://fastweb.b4n1.com/install | bash"
15
+ )
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastweb-sdk
3
+ Version: 0.1.1
4
+ Summary: Python SDK for FastWeb Agentic Browser Engine - Requires explicit binary installation
5
+ Author-email: Bani Montoya <banimontoya@gmail.com>
6
+ License-Expression: MIT OR Apache-2.0
7
+ Project-URL: Homepage, https://github.com/B4N1-com/fastweb
8
+ Project-URL: Repository, https://github.com/B4N1-com/fastweb
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Topic :: Internet :: WWW/HTTP
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: requests>=2.28.0
22
+ Dynamic: license-file
23
+
24
+ # FastWeb Python SDK
25
+
26
+ Python bindings for FastWeb: The Agentic Browser Engine.
27
+
28
+ ## Installation
29
+
30
+ ### 1. Install the FastWeb Binary
31
+
32
+ ```bash
33
+ curl -sL https://fastweb.b4n1.com/install | bash
34
+ ```
35
+
36
+ ### 2. Install the Python SDK
37
+
38
+ ```bash
39
+ pip install fastweb-sdk
40
+ ```
41
+
42
+ On Ubuntu 23.04+ or other externally-managed environments, use a virtual environment:
43
+
44
+ ```bash
45
+ python3 -m venv .venv && source .venv/bin/activate
46
+ pip install fastweb-sdk
47
+ ```
48
+
49
+ Or with pipx:
50
+
51
+ ```bash
52
+ pipx install fastweb-sdk
53
+ ```
54
+
55
+ ## Quick Start
56
+
57
+ ```python
58
+ from fastweb import BrowserMode, AgentBrowser
59
+
60
+ # Create a browser instance
61
+ browser = AgentBrowser(mode=BrowserMode.LIGHT)
62
+
63
+ # Navigate to a page
64
+ page = browser.goto("https://example.com")
65
+
66
+ # Access structured data
67
+ print("Page content:")
68
+ print(page.markdown)
69
+
70
+ print(f"Found {len(page.links)} links")
71
+ print("First 5 links:", page.links[:5])
72
+
73
+ # Extract main content
74
+ main_content = page.get_main_content()
75
+ print("Main content preview:", main_content[:200] + "...")
76
+
77
+ # Find specific links
78
+ github_links = page.find_links_by_text("github")
79
+ print("GitHub links:", github_links)
80
+
81
+ # Close browser when done
82
+ browser.close()
83
+ ```
84
+
85
+ ## Browser Modes
86
+
87
+ ### Light Mode (Default)
88
+
89
+ - **Use case**: Reading articles, scraping static content, extracting links
90
+ - **Performance**: < 15MB RAM, instant startup
91
+ - **Capabilities**: HTML parsing, markdown conversion, link extraction
92
+ - **Limitations**: No JavaScript execution
93
+
94
+ ```python
95
+ browser = AgentBrowser(mode=BrowserMode.LIGHT)
96
+ ```
97
+
98
+ ### Render Mode
99
+
100
+ - **Use case**: SPAs, form filling, visual verification
101
+ - **Performance**: Higher memory usage, slower startup
102
+ - **Capabilities**: Full JavaScript execution, screenshots, interaction
103
+
104
+ ```python
105
+ browser = AgentBrowser(mode=BrowserMode.RENDER)
106
+ ```
107
+
108
+ ## API Reference
109
+
110
+ ### AgentBrowser
111
+
112
+ Main browser class for web automation.
113
+
114
+ #### Methods
115
+
116
+ - `goto(url: str) -> Page`: Navigate to URL and return structured page data
117
+ - `close()`: Close the browser session
118
+
119
+ #### Parameters
120
+
121
+ - `mode`: BrowserMode.LIGHT or BrowserMode.RENDER
122
+ - `timeout`: Request timeout in seconds (default: 30)
123
+ - `user_agent`: Custom user agent string
124
+
125
+ ### Page
126
+
127
+ Structured data from a web page.
128
+
129
+ #### Attributes
130
+
131
+ - `url: str`: The page URL
132
+ - `markdown: str`: Clean markdown content
133
+ - `links: List[str]`: Extracted links
134
+ - `screenshot: Optional[str]`: Base64-encoded screenshot (render mode only)
135
+
136
+ #### Methods
137
+
138
+ - `get_main_content() -> str`: Extract main content, skipping headers/footers
139
+ - `find_links_by_text(text: str) -> List[str]`: Find links containing specific text
140
+
141
+ ## Context Manager
142
+
143
+ Use the browser as a context manager for automatic cleanup:
144
+
145
+ ```python
146
+ from fastweb import BrowserMode, AgentBrowser
147
+
148
+ with AgentBrowser(mode=BrowserMode.LIGHT) as browser:
149
+ page = browser.goto("https://example.com")
150
+ print(page.markdown)
151
+ # Browser automatically closed
152
+ ```
153
+
154
+ ## Security
155
+
156
+ - All HTTP requests use TLS
157
+ - No arbitrary code execution
158
+ - Input validation and sanitization
159
+ - **Explicit Installation**: Binary must be installed separately via `curl -sL https://fastweb.b4n1.com/install | bash` — no automatic downloads
160
+
161
+ ## License
162
+
163
+ MIT OR Apache-2.0
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ fastweb/__init__.py
5
+ fastweb/__main__.py
6
+ fastweb/browser.py
7
+ fastweb/errors.py
8
+ fastweb_sdk.egg-info/PKG-INFO
9
+ fastweb_sdk.egg-info/SOURCES.txt
10
+ fastweb_sdk.egg-info/dependency_links.txt
11
+ fastweb_sdk.egg-info/entry_points.txt
12
+ fastweb_sdk.egg-info/requires.txt
13
+ fastweb_sdk.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ fastweb-install = fastweb.__main__:install_command
@@ -0,0 +1 @@
1
+ requests>=2.28.0
@@ -0,0 +1 @@
1
+ fastweb
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fastweb-sdk"
7
+ version = "0.1.1"
8
+ description = "Python SDK for FastWeb Agentic Browser Engine - Requires explicit binary installation"
9
+ authors = [
10
+ {name = "Bani Montoya", email = "banimontoya@gmail.com"}
11
+ ]
12
+ license = "MIT OR Apache-2.0"
13
+ readme = "README.md"
14
+ requires-python = ">=3.8"
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.8",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Topic :: Internet :: WWW/HTTP",
24
+ "Topic :: Software Development :: Libraries :: Python Modules",
25
+ ]
26
+ dependencies = [
27
+ "requests>=2.28.0",
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/B4N1-com/fastweb"
32
+ Repository = "https://github.com/B4N1-com/fastweb"
33
+
34
+ [project.scripts]
35
+ fastweb-install = "fastweb.__main__:install_command"
36
+
37
+ [tool.setuptools]
38
+ packages = ["fastweb"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+