create-browser-app 0.1.6__py3-none-any.whl → 0.1.8__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.
- create_browser_app/main.py +2 -1
- create_browser_app/template_fetcher.py +53 -58
- {create_browser_app-0.1.6.dist-info → create_browser_app-0.1.8.dist-info}/METADATA +1 -1
- create_browser_app-0.1.8.dist-info/RECORD +9 -0
- create_browser_app-0.1.6.dist-info/RECORD +0 -9
- {create_browser_app-0.1.6.dist-info → create_browser_app-0.1.8.dist-info}/WHEEL +0 -0
- {create_browser_app-0.1.6.dist-info → create_browser_app-0.1.8.dist-info}/entry_points.txt +0 -0
- {create_browser_app-0.1.6.dist-info → create_browser_app-0.1.8.dist-info}/top_level.txt +0 -0
create_browser_app/main.py
CHANGED
|
@@ -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)
|
|
@@ -1,75 +1,70 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
import urllib.request
|
|
3
|
-
import json
|
|
4
3
|
from typing import Dict, List, Optional
|
|
5
|
-
from
|
|
6
|
-
import base64
|
|
4
|
+
from dataclasses import dataclass
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
@dataclass
|
|
7
|
+
class TemplateInfo:
|
|
8
|
+
name: str
|
|
9
|
+
url: str
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
url
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
]
|
|
23
41
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 []
|
|
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
|
|
40
48
|
|
|
41
|
-
def fetch_template_content(
|
|
49
|
+
def fetch_template_content(template: TemplateInfo) -> Optional[str]:
|
|
42
50
|
"""Fetch the content of a specific template from GitHub."""
|
|
43
51
|
try:
|
|
44
|
-
|
|
45
|
-
req = urllib.request.Request(url)
|
|
46
|
-
req.add_header("Accept", "application/vnd.github.v3+json")
|
|
52
|
+
req = urllib.request.Request(template.url)
|
|
47
53
|
req.add_header("User-Agent", "create-browser-app-py")
|
|
48
54
|
|
|
49
55
|
with urllib.request.urlopen(req) as response:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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}")
|
|
56
|
+
if response.status != 200:
|
|
57
|
+
return None
|
|
58
|
+
return response.read().decode("utf-8")
|
|
59
|
+
except Exception:
|
|
62
60
|
return None
|
|
63
61
|
|
|
64
|
-
def
|
|
65
|
-
"""Get a
|
|
66
|
-
|
|
67
|
-
for
|
|
68
|
-
|
|
69
|
-
return template
|
|
70
|
-
return None
|
|
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
|
|
71
67
|
|
|
72
68
|
def list_templates() -> List[str]:
|
|
73
69
|
"""Get a list of template names."""
|
|
74
|
-
|
|
75
|
-
return [t["name"] for t in templates]
|
|
70
|
+
return get_available_templates()
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
create_browser_app/__init__.py,sha256=izlkaSvrxNqPnulbHlD8VYldR618NxRQRlKQFgQn0Gk,42
|
|
2
|
+
create_browser_app/main.py,sha256=8n6Mot1AAM5Vwd7YhzUjresboJtwnt-hwFo1_jBI98Q,4864
|
|
3
|
+
create_browser_app/template_fetcher.py,sha256=_1MZy9WaLt350h0B5qT6GJwJNKQYiS_qTo-X6FpUOmI,2655
|
|
4
|
+
create_browser_app/templates.py,sha256=ipfp4zmfbD4-vhoggEW9M_EBXYvvyCzvmHew9tTgi7w,2636
|
|
5
|
+
create_browser_app-0.1.8.dist-info/METADATA,sha256=J6iscXwPMCObTLmA-SRLEhhHBC_Iwo4qIqs2Fs1v2R4,648
|
|
6
|
+
create_browser_app-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
create_browser_app-0.1.8.dist-info/entry_points.txt,sha256=yyAKhFZs2kraGA_ixwnRZeStL0uxWvBCMzysg8S-0VE,68
|
|
8
|
+
create_browser_app-0.1.8.dist-info/top_level.txt,sha256=sLW8imVtlXvOy1D5aGPBDxbMP3Yvonif7VxcLu_Izy4,19
|
|
9
|
+
create_browser_app-0.1.8.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
create_browser_app/__init__.py,sha256=izlkaSvrxNqPnulbHlD8VYldR618NxRQRlKQFgQn0Gk,42
|
|
2
|
-
create_browser_app/main.py,sha256=eY3dEQK_Qop07SCPNdkOtZKUyX9RnoBJZpmpU_Y1oQI,4789
|
|
3
|
-
create_browser_app/template_fetcher.py,sha256=kfNOFdJlBPjgtAuroVsD-zuXWd04wSpQHTBmYXHDJAc,2723
|
|
4
|
-
create_browser_app/templates.py,sha256=ipfp4zmfbD4-vhoggEW9M_EBXYvvyCzvmHew9tTgi7w,2636
|
|
5
|
-
create_browser_app-0.1.6.dist-info/METADATA,sha256=3NdLNntPKGW8l556SPPJNZMjCGmp7qKE_53-aWL8ilQ,648
|
|
6
|
-
create_browser_app-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
create_browser_app-0.1.6.dist-info/entry_points.txt,sha256=yyAKhFZs2kraGA_ixwnRZeStL0uxWvBCMzysg8S-0VE,68
|
|
8
|
-
create_browser_app-0.1.6.dist-info/top_level.txt,sha256=sLW8imVtlXvOy1D5aGPBDxbMP3Yvonif7VxcLu_Izy4,19
|
|
9
|
-
create_browser_app-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|