create-browser-app 0.1.6__tar.gz → 0.1.8__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.
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/PKG-INFO +1 -1
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app/main.py +2 -1
- create_browser_app-0.1.8/create_browser_app/template_fetcher.py +70 -0
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app.egg-info/PKG-INFO +1 -1
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/pyproject.toml +1 -1
- create_browser_app-0.1.6/create_browser_app/template_fetcher.py +0 -75
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/README.md +0 -0
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app/__init__.py +0 -0
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app/templates.py +0 -0
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app.egg-info/SOURCES.txt +0 -0
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app.egg-info/dependency_links.txt +0 -0
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app.egg-info/entry_points.txt +0 -0
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app.egg-info/requires.txt +0 -0
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app.egg-info/top_level.txt +0 -0
- {create_browser_app-0.1.6 → create_browser_app-0.1.8}/setup.cfg +0 -0
|
@@ -99,7 +99,8 @@ def main(name, template):
|
|
|
99
99
|
f"[bold cyan]1.[/bold cyan] cd {project_dir}\n"
|
|
100
100
|
f"[bold cyan]2.[/bold cyan] cp .env.example .env\n"
|
|
101
101
|
f"[bold cyan]3.[/bold cyan] [dim]Add your Browserbase API key to .env[/dim]\n"
|
|
102
|
-
f"[bold cyan]4.[/bold cyan]
|
|
102
|
+
f"[bold cyan]4.[/bold cyan] pip install -r requirements.txt\n"
|
|
103
|
+
f"[bold cyan]5.[/bold cyan] python main.py",
|
|
103
104
|
title="[bold yellow]🚀 Launch now 🚀[/bold yellow]",
|
|
104
105
|
border_style="yellow",
|
|
105
106
|
padding=(1, 2)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import urllib.request
|
|
3
|
+
from typing import Dict, List, Optional
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class TemplateInfo:
|
|
8
|
+
name: str
|
|
9
|
+
url: str
|
|
10
|
+
|
|
11
|
+
GITHUB_TEMPLATES: List[TemplateInfo] = [
|
|
12
|
+
TemplateInfo(
|
|
13
|
+
name="example",
|
|
14
|
+
url="https://raw.githubusercontent.com/browserbase/stagehand-python/main/examples/example.py",
|
|
15
|
+
),
|
|
16
|
+
TemplateInfo(
|
|
17
|
+
name="cua-example",
|
|
18
|
+
url="https://raw.githubusercontent.com/browserbase/stagehand-python/main/examples/cua-example.py",
|
|
19
|
+
),
|
|
20
|
+
TemplateInfo(
|
|
21
|
+
name="form-filling",
|
|
22
|
+
url="https://raw.githubusercontent.com/browserbase/templates/refs/heads/dev/python/formFilling/index.py?token=GHSAT0AAAAAAC7F2JVDHB7PHQBEWCEXIM762G4ZJYA",
|
|
23
|
+
),
|
|
24
|
+
TemplateInfo(
|
|
25
|
+
name="gift-finder",
|
|
26
|
+
url="https://raw.githubusercontent.com/browserbase/templates/refs/heads/dev/python/giftfinder/index.py?token=GHSAT0AAAAAAC7F2JVCKUTJOS2PJUTQRQ2Q2G4ZT4A",
|
|
27
|
+
),
|
|
28
|
+
TemplateInfo(
|
|
29
|
+
name="pickleball",
|
|
30
|
+
url="https://raw.githubusercontent.com/browserbase/templates/refs/heads/dev/python/pickleball/index.py?token=GHSAT0AAAAAAC7F2JVDHB7PHQBEWCEXIM762G4ZJYA",
|
|
31
|
+
),
|
|
32
|
+
TemplateInfo(
|
|
33
|
+
name="real-estate-check",
|
|
34
|
+
url="https://raw.githubusercontent.com/browserbase/templates/refs/heads/dev/python/realEstateCheck/index.py?token=GHSAT0AAAAAAC7F2JVDHB7PHQBEWCEXIM762G4ZJYA",
|
|
35
|
+
),
|
|
36
|
+
TemplateInfo(
|
|
37
|
+
name="context",
|
|
38
|
+
url="https://raw.githubusercontent.com/browserbase/templates/refs/heads/dev/python/context/index.py?token=GHSAT0AAAAAAC7F2JVDHB7PHQBEWCEXIM762G4ZJYA",
|
|
39
|
+
),
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
def get_template_by_name(name: str) -> Optional[TemplateInfo]:
|
|
43
|
+
"""Get a specific template by name."""
|
|
44
|
+
for template in GITHUB_TEMPLATES:
|
|
45
|
+
if template.name == name:
|
|
46
|
+
return template
|
|
47
|
+
return None
|
|
48
|
+
|
|
49
|
+
def fetch_template_content(template: TemplateInfo) -> Optional[str]:
|
|
50
|
+
"""Fetch the content of a specific template from GitHub."""
|
|
51
|
+
try:
|
|
52
|
+
req = urllib.request.Request(template.url)
|
|
53
|
+
req.add_header("User-Agent", "create-browser-app-py")
|
|
54
|
+
|
|
55
|
+
with urllib.request.urlopen(req) as response:
|
|
56
|
+
if response.status != 200:
|
|
57
|
+
return None
|
|
58
|
+
return response.read().decode("utf-8")
|
|
59
|
+
except Exception:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
def get_available_templates() -> List[str]:
|
|
63
|
+
"""Get a list of available template names."""
|
|
64
|
+
default_templates = ["basic"]
|
|
65
|
+
github_templates = [t.name for t in GITHUB_TEMPLATES]
|
|
66
|
+
return default_templates + github_templates
|
|
67
|
+
|
|
68
|
+
def list_templates() -> List[str]:
|
|
69
|
+
"""Get a list of template names."""
|
|
70
|
+
return get_available_templates()
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
import urllib.request
|
|
3
|
-
import json
|
|
4
|
-
from typing import Dict, List, Optional
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
import base64
|
|
7
|
-
|
|
8
|
-
GITHUB_API_BASE = "https://api.github.com"
|
|
9
|
-
REPO_OWNER = "browserbase"
|
|
10
|
-
REPO_NAME = "stagehand-python"
|
|
11
|
-
EXAMPLES_PATH = "examples"
|
|
12
|
-
|
|
13
|
-
def get_available_templates() -> List[Dict[str, str]]:
|
|
14
|
-
"""Fetch list of available templates from GitHub repository."""
|
|
15
|
-
try:
|
|
16
|
-
url = f"{GITHUB_API_BASE}/repos/{REPO_OWNER}/{REPO_NAME}/contents/{EXAMPLES_PATH}"
|
|
17
|
-
req = urllib.request.Request(url)
|
|
18
|
-
req.add_header("Accept", "application/vnd.github.v3+json")
|
|
19
|
-
req.add_header("User-Agent", "create-browser-app-py")
|
|
20
|
-
|
|
21
|
-
with urllib.request.urlopen(req) as response:
|
|
22
|
-
data = json.loads(response.read().decode())
|
|
23
|
-
|
|
24
|
-
templates = []
|
|
25
|
-
for item in data:
|
|
26
|
-
if item["type"] == "file" and item["name"].endswith(".py"):
|
|
27
|
-
# Keep the original name without replacing underscores
|
|
28
|
-
template_name = item["name"].replace(".py", "")
|
|
29
|
-
templates.append({
|
|
30
|
-
"name": template_name,
|
|
31
|
-
"filename": item["name"],
|
|
32
|
-
"url": item["download_url"],
|
|
33
|
-
"api_url": item["url"]
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
return templates
|
|
37
|
-
except Exception as e:
|
|
38
|
-
print(f"Error fetching templates: {e}")
|
|
39
|
-
return []
|
|
40
|
-
|
|
41
|
-
def fetch_template_content(template_info: Dict[str, str]) -> Optional[str]:
|
|
42
|
-
"""Fetch the content of a specific template from GitHub."""
|
|
43
|
-
try:
|
|
44
|
-
url = template_info.get("api_url", template_info.get("url"))
|
|
45
|
-
req = urllib.request.Request(url)
|
|
46
|
-
req.add_header("Accept", "application/vnd.github.v3+json")
|
|
47
|
-
req.add_header("User-Agent", "create-browser-app-py")
|
|
48
|
-
|
|
49
|
-
with urllib.request.urlopen(req) as response:
|
|
50
|
-
data = json.loads(response.read().decode())
|
|
51
|
-
|
|
52
|
-
if "content" in data:
|
|
53
|
-
content = base64.b64decode(data["content"]).decode("utf-8")
|
|
54
|
-
else:
|
|
55
|
-
# Fallback to direct download
|
|
56
|
-
with urllib.request.urlopen(template_info["url"]) as response:
|
|
57
|
-
content = response.read().decode("utf-8")
|
|
58
|
-
|
|
59
|
-
return content
|
|
60
|
-
except Exception as e:
|
|
61
|
-
print(f"Error fetching template content: {e}")
|
|
62
|
-
return None
|
|
63
|
-
|
|
64
|
-
def get_template_by_name(name: str) -> Optional[Dict[str, str]]:
|
|
65
|
-
"""Get a specific template by name."""
|
|
66
|
-
templates = get_available_templates()
|
|
67
|
-
for template in templates:
|
|
68
|
-
if template["name"] == name:
|
|
69
|
-
return template
|
|
70
|
-
return None
|
|
71
|
-
|
|
72
|
-
def list_templates() -> List[str]:
|
|
73
|
-
"""Get a list of template names."""
|
|
74
|
-
templates = get_available_templates()
|
|
75
|
-
return [t["name"] for t in templates]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app.egg-info/requires.txt
RENAMED
|
File without changes
|
{create_browser_app-0.1.6 → create_browser_app-0.1.8}/create_browser_app.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|