scrapenest 0.3.0__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,52 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.so
5
+ .Python
6
+ build/
7
+ dist/
8
+ *.egg-info/
9
+ .eggs/
10
+
11
+ .env
12
+ .env.local
13
+ .env.*.local
14
+ *.pem
15
+ *.key
16
+ secrets/
17
+
18
+ .venv/
19
+ venv/
20
+ env/
21
+ .python-version
22
+
23
+ .pytest_cache/
24
+ .mypy_cache/
25
+ .ruff_cache/
26
+ .coverage
27
+ htmlcov/
28
+ coverage.xml
29
+
30
+ .idea/
31
+ .vscode/
32
+ *.swp
33
+ *.swo
34
+ .DS_Store
35
+ Thumbs.db
36
+
37
+ *.log
38
+ logs/
39
+
40
+ playwright/.cache/
41
+ .playwright/
42
+
43
+ postgres_data/
44
+ redis_data/
45
+ data/
46
+
47
+ node_modules/
48
+
49
+ scratch/
50
+ .claude/
51
+ *.bak
52
+ *.bak.*
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ScrapeNest
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: scrapenest
3
+ Version: 0.3.0
4
+ Summary: Official Python client for the ScrapeNest API — web scraping, search, AI answers, screenshots, PDFs, Google Maps reviews, and transcription.
5
+ Project-URL: Homepage, https://scrapenest.dev
6
+ Project-URL: Documentation, https://scrapenest.dev/docs
7
+ Project-URL: Repository, https://github.com/jamesmjones/scrapenest-python
8
+ Project-URL: Issues, https://github.com/jamesmjones/scrapenest-python/issues
9
+ Author-email: ScrapeNest <support@scrapenest.dev>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: api,crawler,scrapenest,scraping,screenshot,search,serp,web-scraping
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Internet :: WWW/HTTP
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.9
20
+ Requires-Dist: httpx>=0.27.0
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
23
+ Requires-Dist: pytest>=8.0; extra == 'dev'
24
+ Requires-Dist: respx>=0.21; extra == 'dev'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # scrapenest
28
+
29
+ Official Python client for the [ScrapeNest](https://scrapenest.dev) API — web scraping, search, AI answers, screenshots, PDFs, Google Maps reviews, gas prices, and audio transcription.
30
+
31
+ - Docs: https://scrapenest.dev/docs
32
+ - Get an API key: https://scrapenest.dev
33
+
34
+ ## Install
35
+
36
+ ```bash
37
+ pip install scrapenest
38
+ ```
39
+
40
+ Requires Python 3.9+.
41
+
42
+ ## Quick start
43
+
44
+ ```python
45
+ from scrapenest import Client
46
+
47
+ client = Client("sn_your_key_here")
48
+
49
+ result = client.search("python web scraping", num_results=5)
50
+ for r in result.results:
51
+ print(r.title, r.url)
52
+ ```
53
+
54
+ Every method returns a typed dataclass. Pass `include_usage=True` (where supported) to get a `usage` block with the credits charged.
55
+
56
+ ## Search
57
+
58
+ ```python
59
+ # SERP results. depth = "fast" | "balanced" | "thorough"
60
+ hits = client.search("openai news", depth="balanced", num_results=10)
61
+
62
+ # Search + fetch & clean the top pages
63
+ deep = client.search_deep("what is rust lang", fetch_top=3)
64
+ for page in deep.pages:
65
+ print(page.url, len(page.text or ""))
66
+
67
+ # Cited answer synthesized from live sources
68
+ answer = client.search_answer("who wrote the odyssey", max_sources=3)
69
+ print(answer.answer)
70
+ for c in answer.citations:
71
+ print(c.index, c.url)
72
+ ```
73
+
74
+ ## Scrape a page
75
+
76
+ ```python
77
+ page = client.scrape_url(
78
+ "https://example.com",
79
+ render="auto", # auto | direct | browser | stealth
80
+ extract=True,
81
+ return_markdown=True,
82
+ )
83
+ print(page.title)
84
+ print(page.markdown[:500])
85
+
86
+ # AI extraction
87
+ data = client.scrape_url("https://example.com/product", ai_query="Return the product name and price")
88
+ print(data.ai_extract)
89
+ ```
90
+
91
+ ## Screenshots & PDF
92
+
93
+ ```python
94
+ shot = client.screenshot("https://example.com", full_page=True, format="png")
95
+ with open("page.png", "wb") as f:
96
+ import base64
97
+ f.write(base64.b64decode(shot.image_base64))
98
+
99
+ doc = client.pdf("https://example.com", format="A4", landscape=False)
100
+ with open("page.pdf", "wb") as f:
101
+ import base64
102
+ f.write(base64.b64decode(doc.pdf_base64))
103
+ ```
104
+
105
+ ## Google Maps reviews
106
+
107
+ Pass a place URL, a `0x…:0x…` FID, or a `ChIJ…` place id. Use `place_url` to bypass FID-built URLs for tricky listings.
108
+
109
+ ```python
110
+ res = client.maps_reviews("https://www.google.com/maps/place/...", max_reviews=50, sort="newest")
111
+ print(res.name, res.rating, res.review_count)
112
+ for rev in res.reviews:
113
+ print(rev.author_name, rev.rating, rev.text)
114
+
115
+ # Large pulls run as async jobs
116
+ run = client.maps_reviews_async("ChIJN1t_tDeuEmsRUsoyG83frY4", max_reviews=2000)
117
+ final = client.wait_for_run(run.run_id)
118
+ print(f"{len(final.result['reviews'])} reviews fetched")
119
+ # Need to stop a long job early? client.cancel_run(run.run_id)
120
+ ```
121
+
122
+ ## Gas prices
123
+
124
+ ```python
125
+ gas = client.gas_prices("Los Angeles, CA", grade="regular", limit=10)
126
+ for s in gas.stations:
127
+ print(s.brand, s.address, s.price)
128
+ if gas.region_stats:
129
+ print(gas.region_stats.region, gas.region_stats.average_price)
130
+ ```
131
+
132
+ ## Translate & transcribe
133
+
134
+ ```python
135
+ tr = client.translate("Hello, how are you?", "es")
136
+ print(tr.translated)
137
+
138
+ audio = client.audio_transcript("https://www.youtube.com/watch?v=...")
139
+ print(audio.text)
140
+ ```
141
+
142
+ ## Async client
143
+
144
+ ```python
145
+ import asyncio
146
+ from scrapenest import AsyncClient
147
+
148
+ async def main():
149
+ async with AsyncClient("sn_your_key_here") as client:
150
+ result = await client.search("python web scraping")
151
+ print(result.results[0].title)
152
+
153
+ asyncio.run(main())
154
+ ```
155
+
156
+ `AsyncClient` exposes the same methods as `Client`.
157
+
158
+ ## Error handling
159
+
160
+ ```python
161
+ from scrapenest import RateLimitError, AuthenticationError, PaymentRequiredError
162
+
163
+ try:
164
+ result = client.search("test")
165
+ except RateLimitError as e:
166
+ print(f"Rate limited. Retry after {e.retry_after}s")
167
+ except PaymentRequiredError:
168
+ print("Out of credits")
169
+ except AuthenticationError:
170
+ print("Invalid API key")
171
+ ```
172
+
173
+ ## License
174
+
175
+ MIT
@@ -0,0 +1,149 @@
1
+ # scrapenest
2
+
3
+ Official Python client for the [ScrapeNest](https://scrapenest.dev) API — web scraping, search, AI answers, screenshots, PDFs, Google Maps reviews, gas prices, and audio transcription.
4
+
5
+ - Docs: https://scrapenest.dev/docs
6
+ - Get an API key: https://scrapenest.dev
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ pip install scrapenest
12
+ ```
13
+
14
+ Requires Python 3.9+.
15
+
16
+ ## Quick start
17
+
18
+ ```python
19
+ from scrapenest import Client
20
+
21
+ client = Client("sn_your_key_here")
22
+
23
+ result = client.search("python web scraping", num_results=5)
24
+ for r in result.results:
25
+ print(r.title, r.url)
26
+ ```
27
+
28
+ Every method returns a typed dataclass. Pass `include_usage=True` (where supported) to get a `usage` block with the credits charged.
29
+
30
+ ## Search
31
+
32
+ ```python
33
+ # SERP results. depth = "fast" | "balanced" | "thorough"
34
+ hits = client.search("openai news", depth="balanced", num_results=10)
35
+
36
+ # Search + fetch & clean the top pages
37
+ deep = client.search_deep("what is rust lang", fetch_top=3)
38
+ for page in deep.pages:
39
+ print(page.url, len(page.text or ""))
40
+
41
+ # Cited answer synthesized from live sources
42
+ answer = client.search_answer("who wrote the odyssey", max_sources=3)
43
+ print(answer.answer)
44
+ for c in answer.citations:
45
+ print(c.index, c.url)
46
+ ```
47
+
48
+ ## Scrape a page
49
+
50
+ ```python
51
+ page = client.scrape_url(
52
+ "https://example.com",
53
+ render="auto", # auto | direct | browser | stealth
54
+ extract=True,
55
+ return_markdown=True,
56
+ )
57
+ print(page.title)
58
+ print(page.markdown[:500])
59
+
60
+ # AI extraction
61
+ data = client.scrape_url("https://example.com/product", ai_query="Return the product name and price")
62
+ print(data.ai_extract)
63
+ ```
64
+
65
+ ## Screenshots & PDF
66
+
67
+ ```python
68
+ shot = client.screenshot("https://example.com", full_page=True, format="png")
69
+ with open("page.png", "wb") as f:
70
+ import base64
71
+ f.write(base64.b64decode(shot.image_base64))
72
+
73
+ doc = client.pdf("https://example.com", format="A4", landscape=False)
74
+ with open("page.pdf", "wb") as f:
75
+ import base64
76
+ f.write(base64.b64decode(doc.pdf_base64))
77
+ ```
78
+
79
+ ## Google Maps reviews
80
+
81
+ Pass a place URL, a `0x…:0x…` FID, or a `ChIJ…` place id. Use `place_url` to bypass FID-built URLs for tricky listings.
82
+
83
+ ```python
84
+ res = client.maps_reviews("https://www.google.com/maps/place/...", max_reviews=50, sort="newest")
85
+ print(res.name, res.rating, res.review_count)
86
+ for rev in res.reviews:
87
+ print(rev.author_name, rev.rating, rev.text)
88
+
89
+ # Large pulls run as async jobs
90
+ run = client.maps_reviews_async("ChIJN1t_tDeuEmsRUsoyG83frY4", max_reviews=2000)
91
+ final = client.wait_for_run(run.run_id)
92
+ print(f"{len(final.result['reviews'])} reviews fetched")
93
+ # Need to stop a long job early? client.cancel_run(run.run_id)
94
+ ```
95
+
96
+ ## Gas prices
97
+
98
+ ```python
99
+ gas = client.gas_prices("Los Angeles, CA", grade="regular", limit=10)
100
+ for s in gas.stations:
101
+ print(s.brand, s.address, s.price)
102
+ if gas.region_stats:
103
+ print(gas.region_stats.region, gas.region_stats.average_price)
104
+ ```
105
+
106
+ ## Translate & transcribe
107
+
108
+ ```python
109
+ tr = client.translate("Hello, how are you?", "es")
110
+ print(tr.translated)
111
+
112
+ audio = client.audio_transcript("https://www.youtube.com/watch?v=...")
113
+ print(audio.text)
114
+ ```
115
+
116
+ ## Async client
117
+
118
+ ```python
119
+ import asyncio
120
+ from scrapenest import AsyncClient
121
+
122
+ async def main():
123
+ async with AsyncClient("sn_your_key_here") as client:
124
+ result = await client.search("python web scraping")
125
+ print(result.results[0].title)
126
+
127
+ asyncio.run(main())
128
+ ```
129
+
130
+ `AsyncClient` exposes the same methods as `Client`.
131
+
132
+ ## Error handling
133
+
134
+ ```python
135
+ from scrapenest import RateLimitError, AuthenticationError, PaymentRequiredError
136
+
137
+ try:
138
+ result = client.search("test")
139
+ except RateLimitError as e:
140
+ print(f"Rate limited. Retry after {e.retry_after}s")
141
+ except PaymentRequiredError:
142
+ print("Out of credits")
143
+ except AuthenticationError:
144
+ print("Invalid API key")
145
+ ```
146
+
147
+ ## License
148
+
149
+ MIT
@@ -0,0 +1,41 @@
1
+ [project]
2
+ name = "scrapenest"
3
+ version = "0.3.0"
4
+ description = "Official Python client for the ScrapeNest API — web scraping, search, AI answers, screenshots, PDFs, Google Maps reviews, and transcription."
5
+ readme = "README.md"
6
+ license = { text = "MIT" }
7
+ authors = [{ name = "ScrapeNest", email = "support@scrapenest.dev" }]
8
+ requires-python = ">=3.9"
9
+ dependencies = ["httpx>=0.27.0"]
10
+ keywords = ["scraping", "web-scraping", "api", "search", "serp", "screenshot", "crawler", "scrapenest"]
11
+ classifiers = [
12
+ "Programming Language :: Python :: 3",
13
+ "License :: OSI Approved :: MIT License",
14
+ "Operating System :: OS Independent",
15
+ "Intended Audience :: Developers",
16
+ "Topic :: Internet :: WWW/HTTP",
17
+ "Typing :: Typed",
18
+ ]
19
+
20
+ [project.urls]
21
+ Homepage = "https://scrapenest.dev"
22
+ Documentation = "https://scrapenest.dev/docs"
23
+ Repository = "https://github.com/jamesmjones/scrapenest-python"
24
+ Issues = "https://github.com/jamesmjones/scrapenest-python/issues"
25
+
26
+ [project.optional-dependencies]
27
+ dev = ["pytest>=8.0", "pytest-asyncio>=0.24", "respx>=0.21"]
28
+
29
+ [build-system]
30
+ requires = ["hatchling"]
31
+ build-backend = "hatchling.build"
32
+
33
+ [tool.hatch.build.targets.wheel]
34
+ packages = ["scrapenest"]
35
+
36
+ [tool.hatch.build.targets.sdist]
37
+ include = ["scrapenest", "README.md"]
38
+
39
+ [tool.pytest.ini_options]
40
+ asyncio_mode = "auto"
41
+ testpaths = ["tests"]
@@ -0,0 +1,28 @@
1
+ from ._async_client import AsyncClient
2
+ from ._client import Client
3
+ from .errors import (
4
+ AuthenticationError,
5
+ ForbiddenError,
6
+ NotFoundError,
7
+ PaymentRequiredError,
8
+ RateLimitError,
9
+ ScrapeNestError,
10
+ ServerError,
11
+ UnexpectedResponseError,
12
+ )
13
+
14
+ __version__ = "0.3.0"
15
+
16
+ __all__ = [
17
+ "Client",
18
+ "AsyncClient",
19
+ "ScrapeNestError",
20
+ "AuthenticationError",
21
+ "PaymentRequiredError",
22
+ "ForbiddenError",
23
+ "NotFoundError",
24
+ "RateLimitError",
25
+ "ServerError",
26
+ "UnexpectedResponseError",
27
+ "__version__",
28
+ ]