snaprender 0.7.4__tar.gz → 0.7.5__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.
- {snaprender-0.7.4 → snaprender-0.7.5}/.gitignore +4 -0
- {snaprender-0.7.4 → snaprender-0.7.5}/PKG-INFO +14 -8
- {snaprender-0.7.4 → snaprender-0.7.5}/README.md +13 -7
- {snaprender-0.7.4 → snaprender-0.7.5}/pyproject.toml +1 -1
- {snaprender-0.7.4 → snaprender-0.7.5}/snaprender/__init__.py +1 -1
- {snaprender-0.7.4 → snaprender-0.7.5}/snaprender/client.py +11 -0
- {snaprender-0.7.4 → snaprender-0.7.5}/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: snaprender
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.5
|
|
4
4
|
Summary: Official Python SDK for SnapRender Screenshot API
|
|
5
5
|
Project-URL: Homepage, https://snap-render.com
|
|
6
6
|
Project-URL: Documentation, https://snap-render.com/docs
|
|
@@ -13,11 +13,13 @@ Requires-Python: >=3.8
|
|
|
13
13
|
Requires-Dist: httpx>=0.24
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
|
|
16
|
+
<a href="https://snap-render.com"><img src="https://snap-render.com/brand/snaprender-icon-128.png" alt="SnapRender" width="64" height="64"></a>
|
|
17
|
+
|
|
16
18
|
# snaprender
|
|
17
19
|
|
|
18
20
|
[](https://pypi.org/project/snaprender/)
|
|
19
21
|
[](https://pypi.org/project/snaprender/)
|
|
20
|
-
[](https://
|
|
22
|
+
[](https://pypi.org/project/snaprender/)
|
|
21
23
|
|
|
22
24
|
Official Python SDK for the [SnapRender](https://snap-render.com) Screenshot API. Capture pixel-perfect screenshots, extract page content, run batch jobs, and manage webhooks with a single library.
|
|
23
25
|
|
|
@@ -136,6 +138,7 @@ print(result["image"]) # data:image/png;base64,...
|
|
|
136
138
|
| `width` | int | `1280` | Viewport width in pixels |
|
|
137
139
|
| `height` | int | `800` | Viewport height in pixels |
|
|
138
140
|
| `full_page` | bool | `False` | Capture the full scrollable page |
|
|
141
|
+
| `lazy_load` | bool | `False` | With `full_page`, scroll through the page first so lazy-loaded images appear (usually 1-5 s slower). Ignored unless `full_page` is true |
|
|
139
142
|
| `quality` | int | `90` | JPEG/WebP quality (1-100) |
|
|
140
143
|
| `delay` | int | `0` | Wait (ms) after page load before capture |
|
|
141
144
|
| `dark_mode` | bool | `False` | Emulate dark color scheme |
|
|
@@ -177,6 +180,7 @@ print(result["expires_at"]) # ISO 8601 timestamp
|
|
|
177
180
|
| `width` | int | `None` | Viewport width |
|
|
178
181
|
| `height` | int | `None` | Viewport height |
|
|
179
182
|
| `full_page` | bool | `None` | Full-page capture |
|
|
183
|
+
| `lazy_load` | bool | `None` | With `full_page`, load lazy images first |
|
|
180
184
|
| `quality` | int | `None` | JPEG/WebP quality |
|
|
181
185
|
| `delay` | int | `None` | Wait (ms) after load |
|
|
182
186
|
| `dark_mode` | bool | `None` | Emulate dark mode |
|
|
@@ -254,12 +258,12 @@ job = snap.batch(
|
|
|
254
258
|
width=1280,
|
|
255
259
|
dark_mode=True,
|
|
256
260
|
)
|
|
257
|
-
print(job["
|
|
261
|
+
print(job["jobId"]) # use this to poll status
|
|
258
262
|
```
|
|
259
263
|
|
|
260
264
|
**Options**: same screenshot options as `capture()` (except `url`, `html`, `markdown`, `response_type`, `cache`, `cache_ttl`). These options apply to every URL in the batch.
|
|
261
265
|
|
|
262
|
-
**Returns** `{ "
|
|
266
|
+
**Returns** `{ "jobId": str, "status": str, "statusUrl": str, "total": int, "completed": int, "failed": int, "items": list, ... }`
|
|
263
267
|
|
|
264
268
|
---
|
|
265
269
|
|
|
@@ -273,15 +277,18 @@ import time
|
|
|
273
277
|
job = snap.batch(["https://example.com", "https://example.org"])
|
|
274
278
|
|
|
275
279
|
while True:
|
|
276
|
-
status = snap.get_batch_status(job["
|
|
280
|
+
status = snap.get_batch_status(job["jobId"])
|
|
277
281
|
print(f"{status['status']} - {status.get('completed', 0)}/{status['total']}")
|
|
278
282
|
if status["status"] in ("completed", "failed"):
|
|
279
283
|
break
|
|
280
284
|
time.sleep(2)
|
|
281
285
|
|
|
282
286
|
# Download results
|
|
283
|
-
for
|
|
284
|
-
|
|
287
|
+
for item in status["items"]:
|
|
288
|
+
if item["status"] == "completed":
|
|
289
|
+
print(item["url"], item["downloadUrl"])
|
|
290
|
+
else:
|
|
291
|
+
print(item["url"], item.get("error"))
|
|
285
292
|
```
|
|
286
293
|
|
|
287
294
|
---
|
|
@@ -451,7 +458,6 @@ Common error codes: `INVALID_API_KEY`, `QUOTA_EXCEEDED`, `INVALID_URL`, `VALIDAT
|
|
|
451
458
|
- [Pricing](https://snap-render.com/pricing)
|
|
452
459
|
- [Dashboard](https://app.snap-render.com/dashboard)
|
|
453
460
|
- [Blog](https://snap-render.com/blog)
|
|
454
|
-
- [GitHub](https://github.com/User0856/snaprender)
|
|
455
461
|
|
|
456
462
|
## License
|
|
457
463
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
<a href="https://snap-render.com"><img src="https://snap-render.com/brand/snaprender-icon-128.png" alt="SnapRender" width="64" height="64"></a>
|
|
2
|
+
|
|
1
3
|
# snaprender
|
|
2
4
|
|
|
3
5
|
[](https://pypi.org/project/snaprender/)
|
|
4
6
|
[](https://pypi.org/project/snaprender/)
|
|
5
|
-
[](https://
|
|
7
|
+
[](https://pypi.org/project/snaprender/)
|
|
6
8
|
|
|
7
9
|
Official Python SDK for the [SnapRender](https://snap-render.com) Screenshot API. Capture pixel-perfect screenshots, extract page content, run batch jobs, and manage webhooks with a single library.
|
|
8
10
|
|
|
@@ -121,6 +123,7 @@ print(result["image"]) # data:image/png;base64,...
|
|
|
121
123
|
| `width` | int | `1280` | Viewport width in pixels |
|
|
122
124
|
| `height` | int | `800` | Viewport height in pixels |
|
|
123
125
|
| `full_page` | bool | `False` | Capture the full scrollable page |
|
|
126
|
+
| `lazy_load` | bool | `False` | With `full_page`, scroll through the page first so lazy-loaded images appear (usually 1-5 s slower). Ignored unless `full_page` is true |
|
|
124
127
|
| `quality` | int | `90` | JPEG/WebP quality (1-100) |
|
|
125
128
|
| `delay` | int | `0` | Wait (ms) after page load before capture |
|
|
126
129
|
| `dark_mode` | bool | `False` | Emulate dark color scheme |
|
|
@@ -162,6 +165,7 @@ print(result["expires_at"]) # ISO 8601 timestamp
|
|
|
162
165
|
| `width` | int | `None` | Viewport width |
|
|
163
166
|
| `height` | int | `None` | Viewport height |
|
|
164
167
|
| `full_page` | bool | `None` | Full-page capture |
|
|
168
|
+
| `lazy_load` | bool | `None` | With `full_page`, load lazy images first |
|
|
165
169
|
| `quality` | int | `None` | JPEG/WebP quality |
|
|
166
170
|
| `delay` | int | `None` | Wait (ms) after load |
|
|
167
171
|
| `dark_mode` | bool | `None` | Emulate dark mode |
|
|
@@ -239,12 +243,12 @@ job = snap.batch(
|
|
|
239
243
|
width=1280,
|
|
240
244
|
dark_mode=True,
|
|
241
245
|
)
|
|
242
|
-
print(job["
|
|
246
|
+
print(job["jobId"]) # use this to poll status
|
|
243
247
|
```
|
|
244
248
|
|
|
245
249
|
**Options**: same screenshot options as `capture()` (except `url`, `html`, `markdown`, `response_type`, `cache`, `cache_ttl`). These options apply to every URL in the batch.
|
|
246
250
|
|
|
247
|
-
**Returns** `{ "
|
|
251
|
+
**Returns** `{ "jobId": str, "status": str, "statusUrl": str, "total": int, "completed": int, "failed": int, "items": list, ... }`
|
|
248
252
|
|
|
249
253
|
---
|
|
250
254
|
|
|
@@ -258,15 +262,18 @@ import time
|
|
|
258
262
|
job = snap.batch(["https://example.com", "https://example.org"])
|
|
259
263
|
|
|
260
264
|
while True:
|
|
261
|
-
status = snap.get_batch_status(job["
|
|
265
|
+
status = snap.get_batch_status(job["jobId"])
|
|
262
266
|
print(f"{status['status']} - {status.get('completed', 0)}/{status['total']}")
|
|
263
267
|
if status["status"] in ("completed", "failed"):
|
|
264
268
|
break
|
|
265
269
|
time.sleep(2)
|
|
266
270
|
|
|
267
271
|
# Download results
|
|
268
|
-
for
|
|
269
|
-
|
|
272
|
+
for item in status["items"]:
|
|
273
|
+
if item["status"] == "completed":
|
|
274
|
+
print(item["url"], item["downloadUrl"])
|
|
275
|
+
else:
|
|
276
|
+
print(item["url"], item.get("error"))
|
|
270
277
|
```
|
|
271
278
|
|
|
272
279
|
---
|
|
@@ -436,7 +443,6 @@ Common error codes: `INVALID_API_KEY`, `QUOTA_EXCEEDED`, `INVALID_URL`, `VALIDAT
|
|
|
436
443
|
- [Pricing](https://snap-render.com/pricing)
|
|
437
444
|
- [Dashboard](https://app.snap-render.com/dashboard)
|
|
438
445
|
- [Blog](https://snap-render.com/blog)
|
|
439
|
-
- [GitHub](https://github.com/User0856/snaprender)
|
|
440
446
|
|
|
441
447
|
## License
|
|
442
448
|
|
|
@@ -52,6 +52,7 @@ class SnapRender:
|
|
|
52
52
|
width: Optional[int] = None,
|
|
53
53
|
height: Optional[int] = None,
|
|
54
54
|
full_page: Optional[bool] = None,
|
|
55
|
+
lazy_load: Optional[bool] = None,
|
|
55
56
|
quality: Optional[int] = None,
|
|
56
57
|
delay: Optional[int] = None,
|
|
57
58
|
dark_mode: Optional[bool] = None,
|
|
@@ -87,6 +88,8 @@ class SnapRender:
|
|
|
87
88
|
body["height"] = height
|
|
88
89
|
if full_page is not None:
|
|
89
90
|
body["full_page"] = full_page
|
|
91
|
+
if lazy_load is not None:
|
|
92
|
+
body["lazy_load"] = lazy_load
|
|
90
93
|
if quality is not None:
|
|
91
94
|
body["quality"] = quality
|
|
92
95
|
if delay is not None:
|
|
@@ -123,6 +126,8 @@ class SnapRender:
|
|
|
123
126
|
params["height"] = height
|
|
124
127
|
if full_page is not None:
|
|
125
128
|
params["full_page"] = str(full_page).lower()
|
|
129
|
+
if lazy_load is not None:
|
|
130
|
+
params["lazy_load"] = str(lazy_load).lower()
|
|
126
131
|
if quality is not None:
|
|
127
132
|
params["quality"] = quality
|
|
128
133
|
if delay is not None:
|
|
@@ -165,6 +170,7 @@ class SnapRender:
|
|
|
165
170
|
width: Optional[int] = None,
|
|
166
171
|
height: Optional[int] = None,
|
|
167
172
|
full_page: Optional[bool] = None,
|
|
173
|
+
lazy_load: Optional[bool] = None,
|
|
168
174
|
quality: Optional[int] = None,
|
|
169
175
|
delay: Optional[int] = None,
|
|
170
176
|
dark_mode: Optional[bool] = None,
|
|
@@ -192,6 +198,8 @@ class SnapRender:
|
|
|
192
198
|
body["height"] = height
|
|
193
199
|
if full_page is not None:
|
|
194
200
|
body["full_page"] = full_page
|
|
201
|
+
if lazy_load is not None:
|
|
202
|
+
body["lazy_load"] = lazy_load
|
|
195
203
|
if quality is not None:
|
|
196
204
|
body["quality"] = quality
|
|
197
205
|
if delay is not None:
|
|
@@ -263,6 +271,7 @@ class SnapRender:
|
|
|
263
271
|
width: Optional[int] = None,
|
|
264
272
|
height: Optional[int] = None,
|
|
265
273
|
full_page: Optional[bool] = None,
|
|
274
|
+
lazy_load: Optional[bool] = None,
|
|
266
275
|
quality: Optional[int] = None,
|
|
267
276
|
delay: Optional[int] = None,
|
|
268
277
|
dark_mode: Optional[bool] = None,
|
|
@@ -287,6 +296,8 @@ class SnapRender:
|
|
|
287
296
|
body["height"] = height
|
|
288
297
|
if full_page is not None:
|
|
289
298
|
body["full_page"] = full_page
|
|
299
|
+
if lazy_load is not None:
|
|
300
|
+
body["lazy_load"] = lazy_load
|
|
290
301
|
if quality is not None:
|
|
291
302
|
body["quality"] = quality
|
|
292
303
|
if delay is not None:
|
|
File without changes
|