Official Python client for the WebGlean API
Project description
webglean
Official Python client for the WebGlean API.
pip install webglean
from webglean import WebGlean
client = WebGlean(api_key="wg_your_key") # or set WEBGLEAN_API_KEY
result = client.scrape("https://example.com")
print(result["markdown"])
WebGlean also works as a context manager (with WebGlean(...) as client:), which closes the underlying HTTP connection pool on exit.
Methods
| Method | Endpoint |
|---|---|
scrape(url, ...) |
POST /v1/scrape |
crawl(url, ...) / get_crawl(id) / crawl_and_wait(id, ...) |
POST /v1/crawl, GET /v1/crawl/:id |
extract(url, schema=, prompt=) |
POST /v1/extract |
map(url, ...) |
POST /v1/map |
search(query, ...) |
POST /v1/search |
create_monitor(url, ...) / list_monitors() / get_monitor(id) / delete_monitor(id) |
POST/GET/DELETE /v1/monitor |
batch_scrape(urls=, items=, ...) / get_batch(id) / batch_scrape_and_wait(id, ...) |
POST /v1/batch/scrape, GET /v1/batch/scrape/:id |
crawl_and_wait and batch_scrape_and_wait poll every 2s by default (poll_interval, timeout in seconds) until the job finishes, raising WebGleanError (status 0) on timeout.
Errors
Any non-2xx response raises WebGleanError, with .status and the message set from the API's error body.
Development
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file webglean-0.1.0.tar.gz.
File metadata
- Download URL: webglean-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dabbdef7d8b71c5b1d9f9f79b9f7fb7360cec6178b63aaa42e5ae7b6da665d0
|
|
| MD5 |
0557a25524a927ddcf44a5f50d294876
|
|
| BLAKE2b-256 |
23d83d47af11903c1e3f668dcd32dd697c27052d732faf5c6a1cbe6c871f1e6a
|
File details
Details for the file webglean-0.1.0-py3-none-any.whl.
File metadata
- Download URL: webglean-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25e803ceffc249d4f9dcf6e40a63c36be5015bc17af11732d3c4eded9fb2fa24
|
|
| MD5 |
9d8bed60aa98db1d3d96a571e2d4ae45
|
|
| BLAKE2b-256 |
2bd3201339204a536acbf87e37eb690baf1aaf525921c2c27a3f57b4151e9736
|