lambda-playwright 0.1.2__tar.gz → 0.1.4__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,179 @@
1
+ Metadata-Version: 2.4
2
+ Name: lambda_playwright
3
+ Version: 0.1.4
4
+ Summary: SDK for invoking Lambda Playwright service
5
+ Author: Hubexo
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: requests>=2.25.0
9
+ Requires-Dist: requests-aws4auth>=1.1.0
10
+ Dynamic: author
11
+ Dynamic: description
12
+ Dynamic: description-content-type
13
+ Dynamic: requires-dist
14
+ Dynamic: requires-python
15
+ Dynamic: summary
16
+
17
+ # Lambda Playwright SDK
18
+
19
+ A Python SDK for interacting with the Lambda Playwright service.
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pip install lambda-playwright
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ### Initialization
30
+
31
+ ```python
32
+ from lambda_playwright import LambdaPlaywright
33
+
34
+ # Initialize with environment variables (AWS_PLAYWRIGHT_FUNCTION_URL, AWS_PLAYWRIGHT_ACCESS_KEY, AWS_PLAYWRIGHT_SECRET_ACCESS)
35
+ client = LambdaPlaywright()
36
+
37
+ # Or explicitly
38
+ client = LambdaPlaywright(
39
+ function_url="https://your-function-url.lambda-url.ap-southeast-1.on.aws",
40
+ access_key_id="your-access-key-id",
41
+ secret_access_key="your-secret-access-key",
42
+ region="ap-southeast-2"
43
+ )
44
+ ```
45
+
46
+ ### Visit a Page
47
+
48
+ ```python
49
+ response = client.visit({
50
+ "url": "https://example.com",
51
+ "actions": [
52
+ {"type": "wait_for_selector", "selector": "a"}
53
+ ],
54
+ })
55
+
56
+ print(response["html"])
57
+ ```
58
+
59
+ ### Render HTML
60
+
61
+ ```python
62
+ response = client.render_html({
63
+ "html_content": "<h1>Hello World</h1><script>document.write('Loaded');</script>",
64
+ "actions": [],
65
+ "scroll_to_bottom": True
66
+ })
67
+
68
+ print(response["html"])
69
+ ```
70
+
71
+ ## Development
72
+
73
+ To run locally against a local Lambda container:
74
+
75
+ ```python
76
+ client = LambdaPlaywright(debug=True)
77
+ ```
78
+
79
+ ## Available Actions
80
+
81
+ You can pass a list of actions to be executed on the page.
82
+
83
+ ### `click`
84
+ Clicks on an element matching the selector.
85
+ ```python
86
+ {"type": "click", "selector": "button#submit"}
87
+ ```
88
+
89
+ ### `wait_for_selector`
90
+ Waits for an element to appear in the DOM.
91
+ - `timeout` (optional): Maximum time to wait in milliseconds (default: 10000).
92
+ ```python
93
+ {"type": "wait_for_selector", "selector": ".content", "timeout": 5000}
94
+ ```
95
+
96
+ ### `sleep`
97
+ Pauses execution for a specified duration.
98
+ ```python
99
+ {"type": "sleep", "duration": 2.5} # Sleep for 2.5 seconds
100
+ ```
101
+
102
+ ### `scroll_to_bottom`
103
+ Scrolls to the bottom of the page to load dynamic content.
104
+ ```python
105
+ {"type": "scroll_to_bottom"}
106
+ ```
107
+
108
+ ### `fill`
109
+ Fills a form input field.
110
+ ```python
111
+ {"type": "fill", "selector": "input[name='q']", "value": "search term"}
112
+ ```
113
+
114
+ ### `type`
115
+ Types text into an input field, with optional delay between key presses.
116
+ ```python
117
+ {"type": "type", "selector": "#notes", "text": "Hello", "delay": 100}
118
+ ```
119
+
120
+ ### `evaluate`
121
+ Executes custom JavaScript in the browser context.
122
+ ```python
123
+ {"type": "evaluate", "script": "document.body.style.backgroundColor = 'red'"}
124
+ ```
125
+
126
+ ## Payload Reference
127
+
128
+ ### Visit Page Payload (`client.visit`)
129
+
130
+ | Field | Type | Description |
131
+ |-------|------|-------------|
132
+ | `url` | `str` | **Required**. The URL to visit. |
133
+ | `actions` | `List[Action]` | List of actions to perform. |
134
+ | `headers` | `dict` | Custom HTTP headers. |
135
+ | `cookies` | `dict` | Cookies to set. |
136
+ | `user_agent` | `str` | Custom User-Agent string. |
137
+ | `max_retries` | `int` | Number of retries on failure (default: 3). |
138
+ | `timeout_ms` | `int` | Global timeout in milliseconds (default: 60000). |
139
+ | `wait_for_network_idle` | `bool` | Wait for network to be idle (default: True). |
140
+ | `scroll_to_bottom` | `bool` | Automatically scroll to bottom (default: True). |
141
+
142
+ ### Render HTML Payload (`client.render_html`)
143
+
144
+ | Field | Type | Description |
145
+ |-------|------|-------------|
146
+ | `html_content` | `str` | **Required**. The HTML content to render. |
147
+ | `actions` | `List[Action]` | List of actions to perform. |
148
+ | `max_retries` | `int` | Number of retries on failure (default: 3). |
149
+ | `timeout_ms` | `int` | Global timeout in milliseconds (default: 60000). |
150
+ | `wait_for_network_idle` | `bool` | Wait for network to be idle (default: True). |
151
+ | `scroll_to_bottom` | `bool` | Automatically scroll to bottom (default: False). |
152
+
153
+ ## Publishing to PyPI
154
+
155
+ To publish a new version of the SDK to PyPI:
156
+
157
+ 1. **Update Version**: Increment the version number in `setup.py`.
158
+ ```python
159
+ setup(
160
+ # ...
161
+ version="0.1.x",
162
+ # ...
163
+ )
164
+ ```
165
+
166
+ 2. **Clean Builds**: Remove previous build artifacts.
167
+ ```bash
168
+ rm -rf dist build *.egg-info
169
+ ```
170
+
171
+ 3. **Build Package**: Create source and wheel distributions.
172
+ ```bash
173
+ python3 setup.py sdist bdist_wheel
174
+ ```
175
+
176
+ 4. **Upload**: Upload the new version to PyPI using `twine`.
177
+ ```bash
178
+ twine upload dist/*
179
+ ```
@@ -0,0 +1,163 @@
1
+ # Lambda Playwright SDK
2
+
3
+ A Python SDK for interacting with the Lambda Playwright service.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install lambda-playwright
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Initialization
14
+
15
+ ```python
16
+ from lambda_playwright import LambdaPlaywright
17
+
18
+ # Initialize with environment variables (AWS_PLAYWRIGHT_FUNCTION_URL, AWS_PLAYWRIGHT_ACCESS_KEY, AWS_PLAYWRIGHT_SECRET_ACCESS)
19
+ client = LambdaPlaywright()
20
+
21
+ # Or explicitly
22
+ client = LambdaPlaywright(
23
+ function_url="https://your-function-url.lambda-url.ap-southeast-1.on.aws",
24
+ access_key_id="your-access-key-id",
25
+ secret_access_key="your-secret-access-key",
26
+ region="ap-southeast-2"
27
+ )
28
+ ```
29
+
30
+ ### Visit a Page
31
+
32
+ ```python
33
+ response = client.visit({
34
+ "url": "https://example.com",
35
+ "actions": [
36
+ {"type": "wait_for_selector", "selector": "a"}
37
+ ],
38
+ })
39
+
40
+ print(response["html"])
41
+ ```
42
+
43
+ ### Render HTML
44
+
45
+ ```python
46
+ response = client.render_html({
47
+ "html_content": "<h1>Hello World</h1><script>document.write('Loaded');</script>",
48
+ "actions": [],
49
+ "scroll_to_bottom": True
50
+ })
51
+
52
+ print(response["html"])
53
+ ```
54
+
55
+ ## Development
56
+
57
+ To run locally against a local Lambda container:
58
+
59
+ ```python
60
+ client = LambdaPlaywright(debug=True)
61
+ ```
62
+
63
+ ## Available Actions
64
+
65
+ You can pass a list of actions to be executed on the page.
66
+
67
+ ### `click`
68
+ Clicks on an element matching the selector.
69
+ ```python
70
+ {"type": "click", "selector": "button#submit"}
71
+ ```
72
+
73
+ ### `wait_for_selector`
74
+ Waits for an element to appear in the DOM.
75
+ - `timeout` (optional): Maximum time to wait in milliseconds (default: 10000).
76
+ ```python
77
+ {"type": "wait_for_selector", "selector": ".content", "timeout": 5000}
78
+ ```
79
+
80
+ ### `sleep`
81
+ Pauses execution for a specified duration.
82
+ ```python
83
+ {"type": "sleep", "duration": 2.5} # Sleep for 2.5 seconds
84
+ ```
85
+
86
+ ### `scroll_to_bottom`
87
+ Scrolls to the bottom of the page to load dynamic content.
88
+ ```python
89
+ {"type": "scroll_to_bottom"}
90
+ ```
91
+
92
+ ### `fill`
93
+ Fills a form input field.
94
+ ```python
95
+ {"type": "fill", "selector": "input[name='q']", "value": "search term"}
96
+ ```
97
+
98
+ ### `type`
99
+ Types text into an input field, with optional delay between key presses.
100
+ ```python
101
+ {"type": "type", "selector": "#notes", "text": "Hello", "delay": 100}
102
+ ```
103
+
104
+ ### `evaluate`
105
+ Executes custom JavaScript in the browser context.
106
+ ```python
107
+ {"type": "evaluate", "script": "document.body.style.backgroundColor = 'red'"}
108
+ ```
109
+
110
+ ## Payload Reference
111
+
112
+ ### Visit Page Payload (`client.visit`)
113
+
114
+ | Field | Type | Description |
115
+ |-------|------|-------------|
116
+ | `url` | `str` | **Required**. The URL to visit. |
117
+ | `actions` | `List[Action]` | List of actions to perform. |
118
+ | `headers` | `dict` | Custom HTTP headers. |
119
+ | `cookies` | `dict` | Cookies to set. |
120
+ | `user_agent` | `str` | Custom User-Agent string. |
121
+ | `max_retries` | `int` | Number of retries on failure (default: 3). |
122
+ | `timeout_ms` | `int` | Global timeout in milliseconds (default: 60000). |
123
+ | `wait_for_network_idle` | `bool` | Wait for network to be idle (default: True). |
124
+ | `scroll_to_bottom` | `bool` | Automatically scroll to bottom (default: True). |
125
+
126
+ ### Render HTML Payload (`client.render_html`)
127
+
128
+ | Field | Type | Description |
129
+ |-------|------|-------------|
130
+ | `html_content` | `str` | **Required**. The HTML content to render. |
131
+ | `actions` | `List[Action]` | List of actions to perform. |
132
+ | `max_retries` | `int` | Number of retries on failure (default: 3). |
133
+ | `timeout_ms` | `int` | Global timeout in milliseconds (default: 60000). |
134
+ | `wait_for_network_idle` | `bool` | Wait for network to be idle (default: True). |
135
+ | `scroll_to_bottom` | `bool` | Automatically scroll to bottom (default: False). |
136
+
137
+ ## Publishing to PyPI
138
+
139
+ To publish a new version of the SDK to PyPI:
140
+
141
+ 1. **Update Version**: Increment the version number in `setup.py`.
142
+ ```python
143
+ setup(
144
+ # ...
145
+ version="0.1.x",
146
+ # ...
147
+ )
148
+ ```
149
+
150
+ 2. **Clean Builds**: Remove previous build artifacts.
151
+ ```bash
152
+ rm -rf dist build *.egg-info
153
+ ```
154
+
155
+ 3. **Build Package**: Create source and wheel distributions.
156
+ ```bash
157
+ python3 setup.py sdist bdist_wheel
158
+ ```
159
+
160
+ 4. **Upload**: Upload the new version to PyPI using `twine`.
161
+ ```bash
162
+ twine upload dist/*
163
+ ```
@@ -2,7 +2,7 @@ import os
2
2
  import json
3
3
  import logging
4
4
  import requests
5
- from typing import Optional, Dict, Union, Any
5
+ from typing import Optional, Dict, Any
6
6
  from requests_aws4auth import AWS4Auth
7
7
  from .types import Endpoint, VisitPagePayload, RenderHtmlPayload
8
8
 
@@ -19,7 +19,7 @@ class LambdaPlaywright:
19
19
  function_url: Optional[str] = None,
20
20
  access_key_id: Optional[str] = None,
21
21
  secret_access_key: Optional[str] = None,
22
- region: str = "ap-southeast-1",
22
+ region: str = "ap-southeast-2",
23
23
  debug: bool = False,
24
24
  local_url: str = "http://localhost:9000/2015-03-31/functions/function/invocations",
25
25
  ):
@@ -30,7 +30,7 @@ class LambdaPlaywright:
30
30
  function_url: The AWS Lambda Function URL. Defaults to AWS_PLAYWRIGHT_FUNCTION_URL env var.
31
31
  access_key_id: AWS Access Key ID. Defaults to AWS_PLAYWRIGHT_ACCESS_KEY env var.
32
32
  secret_access_key: AWS Secret Access Key. Defaults to AWS_PLAYWRIGHT_SECRET_ACCESS env var.
33
- region: AWS Region. Defaults to "ap-southeast-1".
33
+ region: AWS Region. Defaults to "ap-southeast-2".
34
34
  debug: If True, invoke local Lambda container. Defaults to False.
35
35
  local_url: URL for local Lambda container. Defaults to standard RIE URL.
36
36
  """
@@ -0,0 +1,179 @@
1
+ Metadata-Version: 2.4
2
+ Name: lambda_playwright
3
+ Version: 0.1.4
4
+ Summary: SDK for invoking Lambda Playwright service
5
+ Author: Hubexo
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: requests>=2.25.0
9
+ Requires-Dist: requests-aws4auth>=1.1.0
10
+ Dynamic: author
11
+ Dynamic: description
12
+ Dynamic: description-content-type
13
+ Dynamic: requires-dist
14
+ Dynamic: requires-python
15
+ Dynamic: summary
16
+
17
+ # Lambda Playwright SDK
18
+
19
+ A Python SDK for interacting with the Lambda Playwright service.
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pip install lambda-playwright
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ### Initialization
30
+
31
+ ```python
32
+ from lambda_playwright import LambdaPlaywright
33
+
34
+ # Initialize with environment variables (AWS_PLAYWRIGHT_FUNCTION_URL, AWS_PLAYWRIGHT_ACCESS_KEY, AWS_PLAYWRIGHT_SECRET_ACCESS)
35
+ client = LambdaPlaywright()
36
+
37
+ # Or explicitly
38
+ client = LambdaPlaywright(
39
+ function_url="https://your-function-url.lambda-url.ap-southeast-1.on.aws",
40
+ access_key_id="your-access-key-id",
41
+ secret_access_key="your-secret-access-key",
42
+ region="ap-southeast-2"
43
+ )
44
+ ```
45
+
46
+ ### Visit a Page
47
+
48
+ ```python
49
+ response = client.visit({
50
+ "url": "https://example.com",
51
+ "actions": [
52
+ {"type": "wait_for_selector", "selector": "a"}
53
+ ],
54
+ })
55
+
56
+ print(response["html"])
57
+ ```
58
+
59
+ ### Render HTML
60
+
61
+ ```python
62
+ response = client.render_html({
63
+ "html_content": "<h1>Hello World</h1><script>document.write('Loaded');</script>",
64
+ "actions": [],
65
+ "scroll_to_bottom": True
66
+ })
67
+
68
+ print(response["html"])
69
+ ```
70
+
71
+ ## Development
72
+
73
+ To run locally against a local Lambda container:
74
+
75
+ ```python
76
+ client = LambdaPlaywright(debug=True)
77
+ ```
78
+
79
+ ## Available Actions
80
+
81
+ You can pass a list of actions to be executed on the page.
82
+
83
+ ### `click`
84
+ Clicks on an element matching the selector.
85
+ ```python
86
+ {"type": "click", "selector": "button#submit"}
87
+ ```
88
+
89
+ ### `wait_for_selector`
90
+ Waits for an element to appear in the DOM.
91
+ - `timeout` (optional): Maximum time to wait in milliseconds (default: 10000).
92
+ ```python
93
+ {"type": "wait_for_selector", "selector": ".content", "timeout": 5000}
94
+ ```
95
+
96
+ ### `sleep`
97
+ Pauses execution for a specified duration.
98
+ ```python
99
+ {"type": "sleep", "duration": 2.5} # Sleep for 2.5 seconds
100
+ ```
101
+
102
+ ### `scroll_to_bottom`
103
+ Scrolls to the bottom of the page to load dynamic content.
104
+ ```python
105
+ {"type": "scroll_to_bottom"}
106
+ ```
107
+
108
+ ### `fill`
109
+ Fills a form input field.
110
+ ```python
111
+ {"type": "fill", "selector": "input[name='q']", "value": "search term"}
112
+ ```
113
+
114
+ ### `type`
115
+ Types text into an input field, with optional delay between key presses.
116
+ ```python
117
+ {"type": "type", "selector": "#notes", "text": "Hello", "delay": 100}
118
+ ```
119
+
120
+ ### `evaluate`
121
+ Executes custom JavaScript in the browser context.
122
+ ```python
123
+ {"type": "evaluate", "script": "document.body.style.backgroundColor = 'red'"}
124
+ ```
125
+
126
+ ## Payload Reference
127
+
128
+ ### Visit Page Payload (`client.visit`)
129
+
130
+ | Field | Type | Description |
131
+ |-------|------|-------------|
132
+ | `url` | `str` | **Required**. The URL to visit. |
133
+ | `actions` | `List[Action]` | List of actions to perform. |
134
+ | `headers` | `dict` | Custom HTTP headers. |
135
+ | `cookies` | `dict` | Cookies to set. |
136
+ | `user_agent` | `str` | Custom User-Agent string. |
137
+ | `max_retries` | `int` | Number of retries on failure (default: 3). |
138
+ | `timeout_ms` | `int` | Global timeout in milliseconds (default: 60000). |
139
+ | `wait_for_network_idle` | `bool` | Wait for network to be idle (default: True). |
140
+ | `scroll_to_bottom` | `bool` | Automatically scroll to bottom (default: True). |
141
+
142
+ ### Render HTML Payload (`client.render_html`)
143
+
144
+ | Field | Type | Description |
145
+ |-------|------|-------------|
146
+ | `html_content` | `str` | **Required**. The HTML content to render. |
147
+ | `actions` | `List[Action]` | List of actions to perform. |
148
+ | `max_retries` | `int` | Number of retries on failure (default: 3). |
149
+ | `timeout_ms` | `int` | Global timeout in milliseconds (default: 60000). |
150
+ | `wait_for_network_idle` | `bool` | Wait for network to be idle (default: True). |
151
+ | `scroll_to_bottom` | `bool` | Automatically scroll to bottom (default: False). |
152
+
153
+ ## Publishing to PyPI
154
+
155
+ To publish a new version of the SDK to PyPI:
156
+
157
+ 1. **Update Version**: Increment the version number in `setup.py`.
158
+ ```python
159
+ setup(
160
+ # ...
161
+ version="0.1.x",
162
+ # ...
163
+ )
164
+ ```
165
+
166
+ 2. **Clean Builds**: Remove previous build artifacts.
167
+ ```bash
168
+ rm -rf dist build *.egg-info
169
+ ```
170
+
171
+ 3. **Build Package**: Create source and wheel distributions.
172
+ ```bash
173
+ python3 setup.py sdist bdist_wheel
174
+ ```
175
+
176
+ 4. **Upload**: Upload the new version to PyPI using `twine`.
177
+ ```bash
178
+ twine upload dist/*
179
+ ```
@@ -6,7 +6,7 @@ long_description = (this_directory / "README.md").read_text()
6
6
 
7
7
  setup(
8
8
  name="lambda_playwright",
9
- version="0.1.2",
9
+ version="0.1.4",
10
10
  description="SDK for invoking Lambda Playwright service",
11
11
  long_description=long_description,
12
12
  long_description_content_type="text/markdown",
@@ -1,77 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: lambda_playwright
3
- Version: 0.1.2
4
- Summary: SDK for invoking Lambda Playwright service
5
- Author: Hubexo
6
- Requires-Python: >=3.8
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: requests>=2.25.0
9
- Requires-Dist: requests-aws4auth>=1.1.0
10
- Dynamic: author
11
- Dynamic: description
12
- Dynamic: description-content-type
13
- Dynamic: requires-dist
14
- Dynamic: requires-python
15
- Dynamic: summary
16
-
17
- # Lambda Playwright SDK
18
-
19
- A Python SDK for interacting with the Lambda Playwright service.
20
-
21
- ## Installation
22
-
23
- ```bash
24
- pip install lambda-playwright
25
- ```
26
-
27
- ## Usage
28
-
29
- ### Initialization
30
-
31
- ```python
32
- from lambda_playwright import LambdaPlaywright
33
-
34
- # Initialize with environment variables (AWS_PLAYWRIGHT_FUNCTION_URL, AWS_PLAYWRIGHT_ACCESS_KEY, AWS_PLAYWRIGHT_SECRET_ACCESS)
35
- client = LambdaPlaywright()
36
-
37
- # Or explicitly
38
- client = LambdaPlaywright(
39
- function_url="https://your-function-url.lambda-url.ap-southeast-1.on.aws",
40
- access_key_id="your-access-key-id",
41
- secret_access_key="your-secret-access-key",
42
- region="ap-southeast-2"
43
- )
44
- ```
45
-
46
- ### Visit a Page
47
-
48
- ```python
49
- response = client.visit({
50
- "url": "https://example.com",
51
- "actions": [
52
- {"type": "wait_for_selector", "selector": "a"}
53
- ],
54
- })
55
-
56
- print(response["html"])
57
- ```
58
-
59
- ### Render HTML
60
-
61
- ```python
62
- response = client.render_html({
63
- "html_content": "<h1>Hello World</h1><script>document.write('Loaded');</script>",
64
- "actions": [],
65
- "scroll_to_bottom": True
66
- })
67
-
68
- print(response["html"])
69
- ```
70
-
71
- ## Development
72
-
73
- To run locally against a local Lambda container:
74
-
75
- ```python
76
- client = LambdaPlaywright(debug=True)
77
- ```
@@ -1,61 +0,0 @@
1
- # Lambda Playwright SDK
2
-
3
- A Python SDK for interacting with the Lambda Playwright service.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- pip install lambda-playwright
9
- ```
10
-
11
- ## Usage
12
-
13
- ### Initialization
14
-
15
- ```python
16
- from lambda_playwright import LambdaPlaywright
17
-
18
- # Initialize with environment variables (AWS_PLAYWRIGHT_FUNCTION_URL, AWS_PLAYWRIGHT_ACCESS_KEY, AWS_PLAYWRIGHT_SECRET_ACCESS)
19
- client = LambdaPlaywright()
20
-
21
- # Or explicitly
22
- client = LambdaPlaywright(
23
- function_url="https://your-function-url.lambda-url.ap-southeast-1.on.aws",
24
- access_key_id="your-access-key-id",
25
- secret_access_key="your-secret-access-key",
26
- region="ap-southeast-2"
27
- )
28
- ```
29
-
30
- ### Visit a Page
31
-
32
- ```python
33
- response = client.visit({
34
- "url": "https://example.com",
35
- "actions": [
36
- {"type": "wait_for_selector", "selector": "a"}
37
- ],
38
- })
39
-
40
- print(response["html"])
41
- ```
42
-
43
- ### Render HTML
44
-
45
- ```python
46
- response = client.render_html({
47
- "html_content": "<h1>Hello World</h1><script>document.write('Loaded');</script>",
48
- "actions": [],
49
- "scroll_to_bottom": True
50
- })
51
-
52
- print(response["html"])
53
- ```
54
-
55
- ## Development
56
-
57
- To run locally against a local Lambda container:
58
-
59
- ```python
60
- client = LambdaPlaywright(debug=True)
61
- ```
@@ -1,77 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: lambda_playwright
3
- Version: 0.1.2
4
- Summary: SDK for invoking Lambda Playwright service
5
- Author: Hubexo
6
- Requires-Python: >=3.8
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: requests>=2.25.0
9
- Requires-Dist: requests-aws4auth>=1.1.0
10
- Dynamic: author
11
- Dynamic: description
12
- Dynamic: description-content-type
13
- Dynamic: requires-dist
14
- Dynamic: requires-python
15
- Dynamic: summary
16
-
17
- # Lambda Playwright SDK
18
-
19
- A Python SDK for interacting with the Lambda Playwright service.
20
-
21
- ## Installation
22
-
23
- ```bash
24
- pip install lambda-playwright
25
- ```
26
-
27
- ## Usage
28
-
29
- ### Initialization
30
-
31
- ```python
32
- from lambda_playwright import LambdaPlaywright
33
-
34
- # Initialize with environment variables (AWS_PLAYWRIGHT_FUNCTION_URL, AWS_PLAYWRIGHT_ACCESS_KEY, AWS_PLAYWRIGHT_SECRET_ACCESS)
35
- client = LambdaPlaywright()
36
-
37
- # Or explicitly
38
- client = LambdaPlaywright(
39
- function_url="https://your-function-url.lambda-url.ap-southeast-1.on.aws",
40
- access_key_id="your-access-key-id",
41
- secret_access_key="your-secret-access-key",
42
- region="ap-southeast-2"
43
- )
44
- ```
45
-
46
- ### Visit a Page
47
-
48
- ```python
49
- response = client.visit({
50
- "url": "https://example.com",
51
- "actions": [
52
- {"type": "wait_for_selector", "selector": "a"}
53
- ],
54
- })
55
-
56
- print(response["html"])
57
- ```
58
-
59
- ### Render HTML
60
-
61
- ```python
62
- response = client.render_html({
63
- "html_content": "<h1>Hello World</h1><script>document.write('Loaded');</script>",
64
- "actions": [],
65
- "scroll_to_bottom": True
66
- })
67
-
68
- print(response["html"])
69
- ```
70
-
71
- ## Development
72
-
73
- To run locally against a local Lambda container:
74
-
75
- ```python
76
- client = LambdaPlaywright(debug=True)
77
- ```