scrapecrate 1.0.0__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.
@@ -0,0 +1,32 @@
1
+ """Official Python SDK of the ScrapeCrate API: one key for YouTube, Google Maps, Trustpilot
2
+ and Meta Ad Library data."""
3
+
4
+ from ._base import Response, __version__
5
+ from ._client import AsyncScrapeCrate, ScrapeCrate
6
+ from .errors import (
7
+ ApiError,
8
+ AuthenticationError,
9
+ ConnectionError,
10
+ InsufficientCreditsError,
11
+ NotFoundError,
12
+ PermissionDeniedError,
13
+ RateLimitError,
14
+ ServiceUnavailableError,
15
+ ValidationError,
16
+ )
17
+
18
+ __all__ = [
19
+ "ApiError",
20
+ "AsyncScrapeCrate",
21
+ "AuthenticationError",
22
+ "ConnectionError",
23
+ "InsufficientCreditsError",
24
+ "NotFoundError",
25
+ "PermissionDeniedError",
26
+ "RateLimitError",
27
+ "Response",
28
+ "ScrapeCrate",
29
+ "ServiceUnavailableError",
30
+ "ValidationError",
31
+ "__version__",
32
+ ]
scrapecrate/_base.py ADDED
@@ -0,0 +1,238 @@
1
+ """HTTP transport (sync and async), response object and API namespaces."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import asyncio
6
+ import os
7
+ import random
8
+ import time
9
+ from collections.abc import AsyncIterator, Iterator
10
+ from dataclasses import dataclass, field
11
+ from typing import TYPE_CHECKING, Any
12
+ from urllib.parse import quote
13
+
14
+ import httpx
15
+
16
+ from .errors import ApiError, ConnectionError, error_for
17
+
18
+ if TYPE_CHECKING:
19
+ from ._client import AsyncScrapeCrate, ScrapeCrate
20
+
21
+ __version__ = "1.0.0"
22
+ DEFAULT_BASE_URL = "https://api.scrapecrate.com"
23
+ ENV_API_KEY = "SCRAPECRATE_API_KEY"
24
+ ENV_BASE_URL = "SCRAPECRATE_BASE_URL"
25
+ RETRY_STATUSES = {429, 500, 502, 503, 504}
26
+
27
+
28
+ @dataclass
29
+ class Response:
30
+ """A successful API response."""
31
+
32
+ data: Any
33
+ meta: dict = field(default_factory=dict)
34
+ next_cursor: str | None = None
35
+ has_more: bool = False
36
+
37
+ @property
38
+ def credits_used(self) -> int:
39
+ return int(self.meta.get("credits_used", 0))
40
+
41
+ @property
42
+ def credits_remaining(self) -> int:
43
+ return int(self.meta.get("credits_remaining", 0))
44
+
45
+ @property
46
+ def request_id(self) -> str | None:
47
+ return self.meta.get("request_id")
48
+
49
+ @classmethod
50
+ def from_body(cls, body: dict) -> Response:
51
+ pag = body.get("pagination") or {}
52
+ return cls(
53
+ data=body.get("data"),
54
+ meta=body.get("meta") or {},
55
+ next_cursor=pag.get("next_cursor"),
56
+ has_more=bool(pag.get("has_more")),
57
+ )
58
+
59
+
60
+ def _clean(params: dict[str, Any]) -> dict[str, str]:
61
+ out: dict[str, str] = {}
62
+ for k, v in params.items():
63
+ if v is None:
64
+ continue
65
+ out[k] = ("true" if v else "false") if isinstance(v, bool) else str(v)
66
+ return out
67
+
68
+
69
+ def build_request(path: str, path_params: tuple[str, ...], params: dict[str, Any]) -> tuple[str, dict]:
70
+ query = dict(params)
71
+ for name in path_params:
72
+ value = query.pop(name, None)
73
+ if value is None:
74
+ raise ValueError(f"missing required parameter: {name}")
75
+ path = path.replace("{" + name + "}", quote(str(value), safe=""))
76
+ return path, _clean(query)
77
+
78
+
79
+ def _retry_after(resp: httpx.Response) -> int | None:
80
+ try:
81
+ return int(resp.headers.get("Retry-After", ""))
82
+ except ValueError:
83
+ return None
84
+
85
+
86
+ def _backoff(attempt: int, retry_after: int | None) -> float:
87
+ if retry_after is not None:
88
+ return float(min(retry_after, 60))
89
+ return min(0.5 * 2**attempt, 8.0) + random.random() * 0.25
90
+
91
+
92
+ NO_RETRY_CODES = {"not_available"} # the API is not launched: retrying never helps
93
+
94
+
95
+ def _retryable(resp: httpx.Response) -> bool:
96
+ if resp.status_code not in RETRY_STATUSES:
97
+ return False
98
+ body = _json(resp)
99
+ code = body.get("error", {}).get("code") if isinstance(body, dict) else None
100
+ return code not in NO_RETRY_CODES
101
+
102
+
103
+ class _Config:
104
+ def __init__(
105
+ self,
106
+ api_key: str | None,
107
+ base_url: str | None,
108
+ timeout: float,
109
+ max_retries: int,
110
+ ) -> None:
111
+ self.api_key = api_key or os.environ.get(ENV_API_KEY)
112
+ if not self.api_key:
113
+ raise ValueError(f"No API key: pass api_key=... or set {ENV_API_KEY}")
114
+ self.base_url = (base_url or os.environ.get(ENV_BASE_URL) or DEFAULT_BASE_URL).rstrip("/")
115
+ self.timeout = timeout
116
+ self.max_retries = max_retries
117
+
118
+ @property
119
+ def headers(self) -> dict[str, str]:
120
+ return {"X-API-Key": self.api_key or "", "User-Agent": f"scrapecrate-python/{__version__}"}
121
+
122
+
123
+ class SyncTransport:
124
+ def __init__(self, config: _Config, http_client: httpx.Client | None = None) -> None:
125
+ self.config = config
126
+ self._http = http_client or httpx.Client(timeout=config.timeout)
127
+
128
+ def get(self, path: str, query: dict[str, str]) -> Response:
129
+ attempt = 0
130
+ while True:
131
+ try:
132
+ resp = self._http.get(self.config.base_url + path, params=query, headers=self.config.headers)
133
+ except httpx.HTTPError as e:
134
+ if attempt < self.config.max_retries:
135
+ time.sleep(_backoff(attempt, None))
136
+ attempt += 1
137
+ continue
138
+ raise ConnectionError(0, "connection_error", str(e)) from e
139
+ if resp.status_code == 200:
140
+ return Response.from_body(resp.json())
141
+ ra = _retry_after(resp)
142
+ if _retryable(resp) and attempt < self.config.max_retries:
143
+ time.sleep(_backoff(attempt, ra))
144
+ attempt += 1
145
+ continue
146
+ raise error_for(resp.status_code, _json(resp), ra)
147
+
148
+ def close(self) -> None:
149
+ self._http.close()
150
+
151
+
152
+ class AsyncTransport:
153
+ def __init__(self, config: _Config, http_client: httpx.AsyncClient | None = None) -> None:
154
+ self.config = config
155
+ self._http = http_client or httpx.AsyncClient(timeout=config.timeout)
156
+
157
+ async def get(self, path: str, query: dict[str, str]) -> Response:
158
+ attempt = 0
159
+ while True:
160
+ try:
161
+ resp = await self._http.get(self.config.base_url + path, params=query, headers=self.config.headers)
162
+ except httpx.HTTPError as e:
163
+ if attempt < self.config.max_retries:
164
+ await asyncio.sleep(_backoff(attempt, None))
165
+ attempt += 1
166
+ continue
167
+ raise ConnectionError(0, "connection_error", str(e)) from e
168
+ if resp.status_code == 200:
169
+ return Response.from_body(resp.json())
170
+ ra = _retry_after(resp)
171
+ if _retryable(resp) and attempt < self.config.max_retries:
172
+ await asyncio.sleep(_backoff(attempt, ra))
173
+ attempt += 1
174
+ continue
175
+ raise error_for(resp.status_code, _json(resp), ra)
176
+
177
+ async def close(self) -> None:
178
+ await self._http.aclose()
179
+
180
+
181
+ def _json(resp: httpx.Response) -> Any:
182
+ try:
183
+ return resp.json()
184
+ except ValueError:
185
+ return resp.text
186
+
187
+
188
+ class Namespace:
189
+ _api = ""
190
+
191
+ def __init__(self, client: ScrapeCrate) -> None:
192
+ self._client = client
193
+
194
+ def _call(self, key: str, params: dict[str, Any], extra: dict[str, Any]) -> Response:
195
+ from ._generated import ENDPOINTS
196
+
197
+ path, path_params, _ = ENDPOINTS[key]
198
+ p, q = build_request(path, path_params, {**params, **extra})
199
+ return self._client._transport.get(p, q)
200
+
201
+ def iterate(self, method: str, **params: Any) -> Iterator[Any]:
202
+ """Yield every item of a list endpoint, following the cursor across pages."""
203
+ fn = getattr(self, method)
204
+ cursor = params.pop("cursor", None)
205
+ while True:
206
+ page = fn(**params, cursor=cursor) if cursor else fn(**params)
207
+ yield from page.data or []
208
+ if not page.has_more or not page.next_cursor:
209
+ return
210
+ cursor = page.next_cursor
211
+
212
+
213
+ class AsyncNamespace:
214
+ _api = ""
215
+
216
+ def __init__(self, client: AsyncScrapeCrate) -> None:
217
+ self._client = client
218
+
219
+ async def _call(self, key: str, params: dict[str, Any], extra: dict[str, Any]) -> Response:
220
+ from ._generated import ENDPOINTS
221
+
222
+ path, path_params, _ = ENDPOINTS[key]
223
+ p, q = build_request(path, path_params, {**params, **extra})
224
+ return await self._client._transport.get(p, q)
225
+
226
+ async def iterate(self, method: str, **params: Any) -> AsyncIterator[Any]:
227
+ fn = getattr(self, method)
228
+ cursor = params.pop("cursor", None)
229
+ while True:
230
+ page = await (fn(**params, cursor=cursor) if cursor else fn(**params))
231
+ for item in page.data or []:
232
+ yield item
233
+ if not page.has_more or not page.next_cursor:
234
+ return
235
+ cursor = page.next_cursor
236
+
237
+
238
+ __all__ = ["ApiError", "Response"]
scrapecrate/_client.py ADDED
@@ -0,0 +1,100 @@
1
+ """Clients: one namespace per API (client.youtube, client.maps, client.trustpilot, client.ads)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ import httpx
8
+
9
+ from ._base import AsyncTransport, Response, SyncTransport, _Config
10
+ from ._generated import (
11
+ AdsApi,
12
+ AsyncAdsApi,
13
+ AsyncMapsApi,
14
+ AsyncTrustpilotApi,
15
+ AsyncYoutubeApi,
16
+ MapsApi,
17
+ TrustpilotApi,
18
+ YoutubeApi,
19
+ )
20
+
21
+
22
+ class ScrapeCrate:
23
+ """Synchronous client.
24
+
25
+ >>> client = ScrapeCrate(api_key="sc_live_...") # or set SCRAPECRATE_API_KEY
26
+ >>> client.youtube.transcript(video_id="dQw4w9WgXcQ").data["text"]
27
+ """
28
+
29
+ youtube: YoutubeApi
30
+ maps: MapsApi
31
+ trustpilot: TrustpilotApi
32
+ ads: AdsApi
33
+
34
+ def __init__(
35
+ self,
36
+ api_key: str | None = None,
37
+ *,
38
+ base_url: str | None = None,
39
+ timeout: float = 90.0,
40
+ max_retries: int = 3,
41
+ http_client: httpx.Client | None = None,
42
+ ) -> None:
43
+ self._transport = SyncTransport(_Config(api_key, base_url, timeout, max_retries), http_client)
44
+ self.youtube = YoutubeApi(self)
45
+ self.maps = MapsApi(self)
46
+ self.trustpilot = TrustpilotApi(self)
47
+ self.ads = AdsApi(self)
48
+
49
+ def account(self) -> Response:
50
+ """Credit balance of the account (free of charge)."""
51
+ return self._transport.get("/v1/account", {})
52
+
53
+ def request(self, path: str, **params: Any) -> Response:
54
+ """Call any endpoint by path, e.g. client.request("/v1/maps/places/search", q="pizza")."""
55
+ return self._transport.get(path, {k: str(v) for k, v in params.items() if v is not None})
56
+
57
+ def close(self) -> None:
58
+ self._transport.close()
59
+
60
+ def __enter__(self) -> ScrapeCrate:
61
+ return self
62
+
63
+ def __exit__(self, *exc: object) -> None:
64
+ self.close()
65
+
66
+
67
+ class AsyncScrapeCrate:
68
+ """Asynchronous client with the same namespaces and methods (awaitable)."""
69
+
70
+ youtube: AsyncYoutubeApi
71
+ maps: AsyncMapsApi
72
+ trustpilot: AsyncTrustpilotApi
73
+ ads: AsyncAdsApi
74
+
75
+ def __init__(
76
+ self,
77
+ api_key: str | None = None,
78
+ *,
79
+ base_url: str | None = None,
80
+ timeout: float = 90.0,
81
+ max_retries: int = 3,
82
+ http_client: httpx.AsyncClient | None = None,
83
+ ) -> None:
84
+ self._transport = AsyncTransport(_Config(api_key, base_url, timeout, max_retries), http_client)
85
+ self.youtube = AsyncYoutubeApi(self)
86
+ self.maps = AsyncMapsApi(self)
87
+ self.trustpilot = AsyncTrustpilotApi(self)
88
+ self.ads = AsyncAdsApi(self)
89
+
90
+ async def account(self) -> Response:
91
+ return await self._transport.get("/v1/account", {})
92
+
93
+ async def close(self) -> None:
94
+ await self._transport.close()
95
+
96
+ async def __aenter__(self) -> AsyncScrapeCrate:
97
+ return self
98
+
99
+ async def __aexit__(self, *exc: object) -> None:
100
+ await self.close()
@@ -0,0 +1,473 @@
1
+ """Generated by sdks/generate.py from catalog/catalog.yaml. Do not edit by hand."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Optional
6
+
7
+ from ._base import AsyncNamespace, Namespace, Response
8
+
9
+ # endpoint key -> (path, path params, list endpoint)
10
+ ENDPOINTS: dict[str, tuple[str, tuple[str, ...], bool]] = {
11
+ "youtube.transcript": ("/v1/youtube/transcripts/{video_id}", ('video_id',), False),
12
+ "youtube.transcript_languages": ("/v1/youtube/transcripts/{video_id}/languages", ('video_id',), False),
13
+ "youtube.video": ("/v1/youtube/videos/{video_id}", ('video_id',), False),
14
+ "youtube.video_chapters": ("/v1/youtube/videos/{video_id}/chapters", ('video_id',), False),
15
+ "youtube.video_comments": ("/v1/youtube/videos/{video_id}/comments", ('video_id',), True),
16
+ "youtube.channel": ("/v1/youtube/channels/{channel_id}", ('channel_id',), False),
17
+ "youtube.channel_videos": ("/v1/youtube/channels/{channel_id}/videos", ('channel_id',), True),
18
+ "youtube.search": ("/v1/youtube/search", (), True),
19
+ "maps.places_search": ("/v1/maps/places/search", (), True),
20
+ "maps.place": ("/v1/maps/places/{place_id}", ('place_id',), False),
21
+ "maps.place_reviews": ("/v1/maps/places/{place_id}/reviews", ('place_id',), True),
22
+ "maps.places_resolve": ("/v1/maps/places/resolve", (), False),
23
+ "trustpilot.companies_search": ("/v1/trustpilot/companies/search", (), True),
24
+ "trustpilot.company": ("/v1/trustpilot/companies/{domain}", ('domain',), False),
25
+ "trustpilot.company_reviews": ("/v1/trustpilot/companies/{domain}/reviews", ('domain',), True),
26
+ "trustpilot.categories": ("/v1/trustpilot/categories", (), False),
27
+ "trustpilot.category_companies": ("/v1/trustpilot/categories/{category_id}/companies", ('category_id',), True),
28
+ "ads.ads_search": ("/v1/ads/search", (), True),
29
+ "ads.ad": ("/v1/ads/{ad_id}", ('ad_id',), False),
30
+ "ads.pages_search": ("/v1/ads/pages/search", (), True),
31
+ "ads.page": ("/v1/ads/pages/{page_id}", ('page_id',), False),
32
+ "ads.page_ads": ("/v1/ads/pages/{page_id}/ads", ('page_id',), True),
33
+ }
34
+
35
+
36
+ class YoutubeApi(Namespace):
37
+ """YouTube API: Transcripts, metadata, comments, channels and search for any public YouTube video."""
38
+
39
+ _api = "youtube"
40
+
41
+ def transcript(self, video_id: str, *, lang: Optional[str] = None, format: Optional[str] = None, **extra: Any) -> Response:
42
+ """Get a transcript.
43
+
44
+ The transcript of a video as timed segments and plain text. Without `lang` you get the video's default caption track.
45
+
46
+ GET /v1/youtube/transcripts/{video_id}
47
+ """
48
+ return self._call("youtube.transcript", {"video_id": video_id, "lang": lang, "format": format}, extra)
49
+
50
+ def transcript_languages(self, video_id: str, **extra: Any) -> Response:
51
+ """List transcript languages.
52
+
53
+ The caption tracks available for a video, manual and auto-generated.
54
+
55
+ GET /v1/youtube/transcripts/{video_id}/languages
56
+ """
57
+ return self._call("youtube.transcript_languages", {"video_id": video_id}, extra)
58
+
59
+ def video(self, video_id: str, **extra: Any) -> Response:
60
+ """Get video metadata.
61
+
62
+ Title, description, channel, duration, views, likes, comment count, tags and categories.
63
+
64
+ GET /v1/youtube/videos/{video_id}
65
+ """
66
+ return self._call("youtube.video", {"video_id": video_id}, extra)
67
+
68
+ def video_chapters(self, video_id: str, **extra: Any) -> Response:
69
+ """Get video chapters.
70
+
71
+ The chapters of a video with start and end times in seconds.
72
+
73
+ GET /v1/youtube/videos/{video_id}/chapters
74
+ """
75
+ return self._call("youtube.video_chapters", {"video_id": video_id}, extra)
76
+
77
+ def video_comments(self, video_id: str, *, sort: Optional[str] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
78
+ """List video comments.
79
+
80
+ Top-level comments of a video with author, likes, replies count, date and pinned flag.
81
+
82
+ GET /v1/youtube/videos/{video_id}/comments
83
+ """
84
+ return self._call("youtube.video_comments", {"video_id": video_id, "sort": sort, "limit": limit, "cursor": cursor}, extra)
85
+
86
+ def channel(self, channel_id: str, **extra: Any) -> Response:
87
+ """Get a channel.
88
+
89
+ Channel details by channel ID (`UC...`) or @handle.
90
+
91
+ GET /v1/youtube/channels/{channel_id}
92
+ """
93
+ return self._call("youtube.channel", {"channel_id": channel_id}, extra)
94
+
95
+ def channel_videos(self, channel_id: str, *, include_shorts: Optional[bool] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
96
+ """List channel videos.
97
+
98
+ The videos of a channel, newest first, page by page.
99
+
100
+ GET /v1/youtube/channels/{channel_id}/videos
101
+ """
102
+ return self._call("youtube.channel_videos", {"channel_id": channel_id, "include_shorts": include_shorts, "limit": limit, "cursor": cursor}, extra)
103
+
104
+ def search(self, q: str, *, limit: Optional[int] = None, **extra: Any) -> Response:
105
+ """Search videos.
106
+
107
+ Search by keyword and get videos with channel, duration, views and upload date.
108
+
109
+ GET /v1/youtube/search
110
+ """
111
+ return self._call("youtube.search", {"q": q, "limit": limit}, extra)
112
+
113
+ class MapsApi(Namespace):
114
+ """Google Maps API: Search places, get full place details and every review, from any country."""
115
+
116
+ _api = "maps"
117
+
118
+ def places_search(self, q: str, *, language: Optional[str] = None, region: Optional[str] = None, lat: Optional[float] = None, lng: Optional[float] = None, radius_km: Optional[float] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
119
+ """Search places.
120
+
121
+ Places matching a query, optionally around a point, up to 20 per call.
122
+
123
+ GET /v1/maps/places/search
124
+ """
125
+ return self._call("maps.places_search", {"q": q, "language": language, "region": region, "lat": lat, "lng": lng, "radius_km": radius_km, "limit": limit, "cursor": cursor}, extra)
126
+
127
+ def place(self, place_id: str, *, language: Optional[str] = None, region: Optional[str] = None, **extra: Any) -> Response:
128
+ """Get place details.
129
+
130
+ Full details of a place by place ID, CID or feature ID.
131
+
132
+ GET /v1/maps/places/{place_id}
133
+ """
134
+ return self._call("maps.place", {"place_id": place_id, "language": language, "region": region}, extra)
135
+
136
+ def place_reviews(self, place_id: str, *, sort: Optional[str] = None, language: Optional[str] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
137
+ """List place reviews.
138
+
139
+ Reviews of a place with rating, text, translation, date and owner response.
140
+
141
+ GET /v1/maps/places/{place_id}/reviews
142
+ """
143
+ return self._call("maps.place_reviews", {"place_id": place_id, "sort": sort, "language": language, "limit": limit, "cursor": cursor}, extra)
144
+
145
+ def places_resolve(self, input: str, **extra: Any) -> Response:
146
+ """Resolve a Maps URL or ID.
147
+
148
+ Turn any Google Maps URL, short link, CID or feature ID into the place IDs.
149
+
150
+ GET /v1/maps/places/resolve
151
+ """
152
+ return self._call("maps.places_resolve", {"input": input}, extra)
153
+
154
+ class TrustpilotApi(Namespace):
155
+ """Trustpilot Reviews API: Company profiles, trust scores and every public review, filterable by stars, language and date."""
156
+
157
+ _api = "trustpilot"
158
+
159
+ def companies_search(self, query: str, *, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
160
+ """Search companies.
161
+
162
+ Companies matching a name or domain.
163
+
164
+ GET /v1/trustpilot/companies/search
165
+ """
166
+ return self._call("trustpilot.companies_search", {"query": query, "limit": limit, "cursor": cursor}, extra)
167
+
168
+ def company(self, domain: str, *, include_similar: Optional[bool] = None, **extra: Any) -> Response:
169
+ """Get a company.
170
+
171
+ Company profile with trust score, star distribution, languages and reply behaviour.
172
+
173
+ GET /v1/trustpilot/companies/{domain}
174
+ """
175
+ return self._call("trustpilot.company", {"domain": domain, "include_similar": include_similar}, extra)
176
+
177
+ def company_reviews(self, domain: str, *, stars: Optional[str] = None, language: Optional[str] = None, since: Optional[str] = None, until: Optional[str] = None, verified: Optional[bool] = None, with_reply: Optional[bool] = None, search: Optional[str] = None, sort: Optional[str] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
178
+ """List company reviews.
179
+
180
+ Public reviews of a company with filters. `meta.complete` is false when the source caps the reviews reachable for a filter combination.
181
+
182
+ GET /v1/trustpilot/companies/{domain}/reviews
183
+ """
184
+ return self._call("trustpilot.company_reviews", {"domain": domain, "stars": stars, "language": language, "since": since, "until": until, "verified": verified, "with_reply": with_reply, "search": search, "sort": sort, "limit": limit, "cursor": cursor}, extra)
185
+
186
+ def categories(self, **extra: Any) -> Response:
187
+ """List categories.
188
+
189
+ The category tree used to browse companies.
190
+
191
+ GET /v1/trustpilot/categories
192
+ """
193
+ return self._call("trustpilot.categories", {}, extra)
194
+
195
+ def category_companies(self, category_id: str, country: str, *, sort: Optional[str] = None, min_trust_score: Optional[str] = None, location: Optional[str] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
196
+ """List companies in a category.
197
+
198
+ Companies of a category in a country, with optional trust score and city filters.
199
+
200
+ GET /v1/trustpilot/categories/{category_id}/companies
201
+ """
202
+ return self._call("trustpilot.category_companies", {"category_id": category_id, "country": country, "sort": sort, "min_trust_score": min_trust_score, "location": location, "limit": limit, "cursor": cursor}, extra)
203
+
204
+ class AdsApi(Namespace):
205
+ """Meta Ad Library API: Search the ads running on Facebook and Instagram, with creatives, dates and advertiser."""
206
+
207
+ _api = "ads"
208
+
209
+ def ads_search(self, *, q: Optional[str] = None, page_id: Optional[str] = None, country: Optional[str] = None, status: Optional[str] = None, ad_type: Optional[str] = None, media_type: Optional[str] = None, platforms: Optional[str] = None, languages: Optional[str] = None, active_from: Optional[str] = None, active_to: Optional[str] = None, match: Optional[str] = None, sort: Optional[str] = None, min_days_active: Optional[int] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
210
+ """Search ads.
211
+
212
+ Ads matching a keyword or an advertiser page, with filters, up to 30 per call. Every ad carries days_active (whole days from started_at to ended_at, or to today while it runs; null when unknown) and winning_score (0-100, null when days_active is null): long-running ads are the ones that pay off. score = L + V + R, with L = 70 x min(days_active, 90) / 90, V = 15 x min(variants_count - 1, 9) / 9 and R = 15 x min(log10(1 + EU reach) / 6, 1). The EU reach is only in the single-ad lookup, so in lists score = (L + V) x 100 / 85: a missing reach never lowers it. Rounded to the nearest integer. min_days_active and sort=longevity apply to the ads of the returned page, at the same price.
213
+
214
+ GET /v1/ads/search
215
+ """
216
+ return self._call("ads.ads_search", {"q": q, "page_id": page_id, "country": country, "status": status, "ad_type": ad_type, "media_type": media_type, "platforms": platforms, "languages": languages, "active_from": active_from, "active_to": active_to, "match": match, "sort": sort, "min_days_active": min_days_active, "limit": limit, "cursor": cursor}, extra)
217
+
218
+ def ad(self, ad_id: str, *, country: Optional[str] = None, **extra: Any) -> Response:
219
+ """Get an ad.
220
+
221
+ One ad with creatives, payer and beneficiary, and EU/UK transparency data.
222
+
223
+ GET /v1/ads/{ad_id}
224
+ """
225
+ return self._call("ads.ad", {"ad_id": ad_id, "country": country}, extra)
226
+
227
+ def pages_search(self, q: str, *, country: Optional[str] = None, limit: Optional[int] = None, **extra: Any) -> Response:
228
+ """Search advertisers.
229
+
230
+ Advertiser pages whose ads match a keyword.
231
+
232
+ GET /v1/ads/pages/search
233
+ """
234
+ return self._call("ads.pages_search", {"q": q, "country": country, "limit": limit}, extra)
235
+
236
+ def page(self, page_id: str, **extra: Any) -> Response:
237
+ """Get an advertiser.
238
+
239
+ Advertiser page details with Instagram account and active ads estimate.
240
+
241
+ GET /v1/ads/pages/{page_id}
242
+ """
243
+ return self._call("ads.page", {"page_id": page_id}, extra)
244
+
245
+ def page_ads(self, page_id: str, *, country: Optional[str] = None, status: Optional[str] = None, media_type: Optional[str] = None, sort: Optional[str] = None, min_days_active: Optional[int] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
246
+ """List an advertiser's ads.
247
+
248
+ The ads of one advertiser page, with the same filters as search, including days_active and winning_score on every ad (see Search ads for the formula), min_days_active and sort=longevity.
249
+
250
+ GET /v1/ads/pages/{page_id}/ads
251
+ """
252
+ return self._call("ads.page_ads", {"page_id": page_id, "country": country, "status": status, "media_type": media_type, "sort": sort, "min_days_active": min_days_active, "limit": limit, "cursor": cursor}, extra)
253
+
254
+ class AsyncYoutubeApi(AsyncNamespace):
255
+ """YouTube API: Transcripts, metadata, comments, channels and search for any public YouTube video."""
256
+
257
+ _api = "youtube"
258
+
259
+ async def transcript(self, video_id: str, *, lang: Optional[str] = None, format: Optional[str] = None, **extra: Any) -> Response:
260
+ """Get a transcript.
261
+
262
+ The transcript of a video as timed segments and plain text. Without `lang` you get the video's default caption track.
263
+
264
+ GET /v1/youtube/transcripts/{video_id}
265
+ """
266
+ return await self._call("youtube.transcript", {"video_id": video_id, "lang": lang, "format": format}, extra)
267
+
268
+ async def transcript_languages(self, video_id: str, **extra: Any) -> Response:
269
+ """List transcript languages.
270
+
271
+ The caption tracks available for a video, manual and auto-generated.
272
+
273
+ GET /v1/youtube/transcripts/{video_id}/languages
274
+ """
275
+ return await self._call("youtube.transcript_languages", {"video_id": video_id}, extra)
276
+
277
+ async def video(self, video_id: str, **extra: Any) -> Response:
278
+ """Get video metadata.
279
+
280
+ Title, description, channel, duration, views, likes, comment count, tags and categories.
281
+
282
+ GET /v1/youtube/videos/{video_id}
283
+ """
284
+ return await self._call("youtube.video", {"video_id": video_id}, extra)
285
+
286
+ async def video_chapters(self, video_id: str, **extra: Any) -> Response:
287
+ """Get video chapters.
288
+
289
+ The chapters of a video with start and end times in seconds.
290
+
291
+ GET /v1/youtube/videos/{video_id}/chapters
292
+ """
293
+ return await self._call("youtube.video_chapters", {"video_id": video_id}, extra)
294
+
295
+ async def video_comments(self, video_id: str, *, sort: Optional[str] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
296
+ """List video comments.
297
+
298
+ Top-level comments of a video with author, likes, replies count, date and pinned flag.
299
+
300
+ GET /v1/youtube/videos/{video_id}/comments
301
+ """
302
+ return await self._call("youtube.video_comments", {"video_id": video_id, "sort": sort, "limit": limit, "cursor": cursor}, extra)
303
+
304
+ async def channel(self, channel_id: str, **extra: Any) -> Response:
305
+ """Get a channel.
306
+
307
+ Channel details by channel ID (`UC...`) or @handle.
308
+
309
+ GET /v1/youtube/channels/{channel_id}
310
+ """
311
+ return await self._call("youtube.channel", {"channel_id": channel_id}, extra)
312
+
313
+ async def channel_videos(self, channel_id: str, *, include_shorts: Optional[bool] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
314
+ """List channel videos.
315
+
316
+ The videos of a channel, newest first, page by page.
317
+
318
+ GET /v1/youtube/channels/{channel_id}/videos
319
+ """
320
+ return await self._call("youtube.channel_videos", {"channel_id": channel_id, "include_shorts": include_shorts, "limit": limit, "cursor": cursor}, extra)
321
+
322
+ async def search(self, q: str, *, limit: Optional[int] = None, **extra: Any) -> Response:
323
+ """Search videos.
324
+
325
+ Search by keyword and get videos with channel, duration, views and upload date.
326
+
327
+ GET /v1/youtube/search
328
+ """
329
+ return await self._call("youtube.search", {"q": q, "limit": limit}, extra)
330
+
331
+ class AsyncMapsApi(AsyncNamespace):
332
+ """Google Maps API: Search places, get full place details and every review, from any country."""
333
+
334
+ _api = "maps"
335
+
336
+ async def places_search(self, q: str, *, language: Optional[str] = None, region: Optional[str] = None, lat: Optional[float] = None, lng: Optional[float] = None, radius_km: Optional[float] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
337
+ """Search places.
338
+
339
+ Places matching a query, optionally around a point, up to 20 per call.
340
+
341
+ GET /v1/maps/places/search
342
+ """
343
+ return await self._call("maps.places_search", {"q": q, "language": language, "region": region, "lat": lat, "lng": lng, "radius_km": radius_km, "limit": limit, "cursor": cursor}, extra)
344
+
345
+ async def place(self, place_id: str, *, language: Optional[str] = None, region: Optional[str] = None, **extra: Any) -> Response:
346
+ """Get place details.
347
+
348
+ Full details of a place by place ID, CID or feature ID.
349
+
350
+ GET /v1/maps/places/{place_id}
351
+ """
352
+ return await self._call("maps.place", {"place_id": place_id, "language": language, "region": region}, extra)
353
+
354
+ async def place_reviews(self, place_id: str, *, sort: Optional[str] = None, language: Optional[str] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
355
+ """List place reviews.
356
+
357
+ Reviews of a place with rating, text, translation, date and owner response.
358
+
359
+ GET /v1/maps/places/{place_id}/reviews
360
+ """
361
+ return await self._call("maps.place_reviews", {"place_id": place_id, "sort": sort, "language": language, "limit": limit, "cursor": cursor}, extra)
362
+
363
+ async def places_resolve(self, input: str, **extra: Any) -> Response:
364
+ """Resolve a Maps URL or ID.
365
+
366
+ Turn any Google Maps URL, short link, CID or feature ID into the place IDs.
367
+
368
+ GET /v1/maps/places/resolve
369
+ """
370
+ return await self._call("maps.places_resolve", {"input": input}, extra)
371
+
372
+ class AsyncTrustpilotApi(AsyncNamespace):
373
+ """Trustpilot Reviews API: Company profiles, trust scores and every public review, filterable by stars, language and date."""
374
+
375
+ _api = "trustpilot"
376
+
377
+ async def companies_search(self, query: str, *, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
378
+ """Search companies.
379
+
380
+ Companies matching a name or domain.
381
+
382
+ GET /v1/trustpilot/companies/search
383
+ """
384
+ return await self._call("trustpilot.companies_search", {"query": query, "limit": limit, "cursor": cursor}, extra)
385
+
386
+ async def company(self, domain: str, *, include_similar: Optional[bool] = None, **extra: Any) -> Response:
387
+ """Get a company.
388
+
389
+ Company profile with trust score, star distribution, languages and reply behaviour.
390
+
391
+ GET /v1/trustpilot/companies/{domain}
392
+ """
393
+ return await self._call("trustpilot.company", {"domain": domain, "include_similar": include_similar}, extra)
394
+
395
+ async def company_reviews(self, domain: str, *, stars: Optional[str] = None, language: Optional[str] = None, since: Optional[str] = None, until: Optional[str] = None, verified: Optional[bool] = None, with_reply: Optional[bool] = None, search: Optional[str] = None, sort: Optional[str] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
396
+ """List company reviews.
397
+
398
+ Public reviews of a company with filters. `meta.complete` is false when the source caps the reviews reachable for a filter combination.
399
+
400
+ GET /v1/trustpilot/companies/{domain}/reviews
401
+ """
402
+ return await self._call("trustpilot.company_reviews", {"domain": domain, "stars": stars, "language": language, "since": since, "until": until, "verified": verified, "with_reply": with_reply, "search": search, "sort": sort, "limit": limit, "cursor": cursor}, extra)
403
+
404
+ async def categories(self, **extra: Any) -> Response:
405
+ """List categories.
406
+
407
+ The category tree used to browse companies.
408
+
409
+ GET /v1/trustpilot/categories
410
+ """
411
+ return await self._call("trustpilot.categories", {}, extra)
412
+
413
+ async def category_companies(self, category_id: str, country: str, *, sort: Optional[str] = None, min_trust_score: Optional[str] = None, location: Optional[str] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
414
+ """List companies in a category.
415
+
416
+ Companies of a category in a country, with optional trust score and city filters.
417
+
418
+ GET /v1/trustpilot/categories/{category_id}/companies
419
+ """
420
+ return await self._call("trustpilot.category_companies", {"category_id": category_id, "country": country, "sort": sort, "min_trust_score": min_trust_score, "location": location, "limit": limit, "cursor": cursor}, extra)
421
+
422
+ class AsyncAdsApi(AsyncNamespace):
423
+ """Meta Ad Library API: Search the ads running on Facebook and Instagram, with creatives, dates and advertiser."""
424
+
425
+ _api = "ads"
426
+
427
+ async def ads_search(self, *, q: Optional[str] = None, page_id: Optional[str] = None, country: Optional[str] = None, status: Optional[str] = None, ad_type: Optional[str] = None, media_type: Optional[str] = None, platforms: Optional[str] = None, languages: Optional[str] = None, active_from: Optional[str] = None, active_to: Optional[str] = None, match: Optional[str] = None, sort: Optional[str] = None, min_days_active: Optional[int] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
428
+ """Search ads.
429
+
430
+ Ads matching a keyword or an advertiser page, with filters, up to 30 per call. Every ad carries days_active (whole days from started_at to ended_at, or to today while it runs; null when unknown) and winning_score (0-100, null when days_active is null): long-running ads are the ones that pay off. score = L + V + R, with L = 70 x min(days_active, 90) / 90, V = 15 x min(variants_count - 1, 9) / 9 and R = 15 x min(log10(1 + EU reach) / 6, 1). The EU reach is only in the single-ad lookup, so in lists score = (L + V) x 100 / 85: a missing reach never lowers it. Rounded to the nearest integer. min_days_active and sort=longevity apply to the ads of the returned page, at the same price.
431
+
432
+ GET /v1/ads/search
433
+ """
434
+ return await self._call("ads.ads_search", {"q": q, "page_id": page_id, "country": country, "status": status, "ad_type": ad_type, "media_type": media_type, "platforms": platforms, "languages": languages, "active_from": active_from, "active_to": active_to, "match": match, "sort": sort, "min_days_active": min_days_active, "limit": limit, "cursor": cursor}, extra)
435
+
436
+ async def ad(self, ad_id: str, *, country: Optional[str] = None, **extra: Any) -> Response:
437
+ """Get an ad.
438
+
439
+ One ad with creatives, payer and beneficiary, and EU/UK transparency data.
440
+
441
+ GET /v1/ads/{ad_id}
442
+ """
443
+ return await self._call("ads.ad", {"ad_id": ad_id, "country": country}, extra)
444
+
445
+ async def pages_search(self, q: str, *, country: Optional[str] = None, limit: Optional[int] = None, **extra: Any) -> Response:
446
+ """Search advertisers.
447
+
448
+ Advertiser pages whose ads match a keyword.
449
+
450
+ GET /v1/ads/pages/search
451
+ """
452
+ return await self._call("ads.pages_search", {"q": q, "country": country, "limit": limit}, extra)
453
+
454
+ async def page(self, page_id: str, **extra: Any) -> Response:
455
+ """Get an advertiser.
456
+
457
+ Advertiser page details with Instagram account and active ads estimate.
458
+
459
+ GET /v1/ads/pages/{page_id}
460
+ """
461
+ return await self._call("ads.page", {"page_id": page_id}, extra)
462
+
463
+ async def page_ads(self, page_id: str, *, country: Optional[str] = None, status: Optional[str] = None, media_type: Optional[str] = None, sort: Optional[str] = None, min_days_active: Optional[int] = None, limit: Optional[int] = None, cursor: Optional[str] = None, **extra: Any) -> Response:
464
+ """List an advertiser's ads.
465
+
466
+ The ads of one advertiser page, with the same filters as search, including days_active and winning_score on every ad (see Search ads for the formula), min_days_active and sort=longevity.
467
+
468
+ GET /v1/ads/pages/{page_id}/ads
469
+ """
470
+ return await self._call("ads.page_ads", {"page_id": page_id, "country": country, "status": status, "media_type": media_type, "sort": sort, "min_days_active": min_days_active, "limit": limit, "cursor": cursor}, extra)
471
+
472
+ API_CLASSES = {'youtube': YoutubeApi, 'maps': MapsApi, 'trustpilot': TrustpilotApi, 'ads': AdsApi}
473
+ ASYNC_API_CLASSES = {'youtube': AsyncYoutubeApi, 'maps': AsyncMapsApi, 'trustpilot': AsyncTrustpilotApi, 'ads': AsyncAdsApi}
scrapecrate/errors.py ADDED
@@ -0,0 +1,81 @@
1
+ """Typed errors. Every error carries the API's code, message, request id and details."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+
8
+ class ApiError(Exception):
9
+ def __init__(
10
+ self,
11
+ status: int,
12
+ code: str,
13
+ message: str,
14
+ request_id: str | None = None,
15
+ details: Any = None,
16
+ retry_after: int | None = None,
17
+ ) -> None:
18
+ super().__init__(f"{status} {code}: {message}")
19
+ self.status = status
20
+ self.code = code
21
+ self.message = message
22
+ self.request_id = request_id
23
+ self.details = details
24
+ self.retry_after = retry_after
25
+
26
+
27
+ class ValidationError(ApiError):
28
+ """400: a parameter is missing or invalid (see .details)."""
29
+
30
+
31
+ class AuthenticationError(ApiError):
32
+ """401: missing or invalid API key."""
33
+
34
+
35
+ class InsufficientCreditsError(ApiError):
36
+ """402: the balance is lower than the price of the call."""
37
+
38
+
39
+ class PermissionDeniedError(ApiError):
40
+ """403: account disabled."""
41
+
42
+
43
+ class NotFoundError(ApiError):
44
+ """404: the resource does not exist. Not billed."""
45
+
46
+
47
+ class RateLimitError(ApiError):
48
+ """429: too many requests; see .retry_after."""
49
+
50
+
51
+ class ServiceUnavailableError(ApiError):
52
+ """5xx: the data source is temporarily unavailable. Not billed; retry later."""
53
+
54
+
55
+ class ConnectionError(ApiError):
56
+ """The API could not be reached."""
57
+
58
+
59
+ _BY_STATUS = {
60
+ 400: ValidationError,
61
+ 401: AuthenticationError,
62
+ 402: InsufficientCreditsError,
63
+ 403: PermissionDeniedError,
64
+ 404: NotFoundError,
65
+ 429: RateLimitError,
66
+ }
67
+
68
+
69
+ def error_for(status: int, body: Any, retry_after: int | None) -> ApiError:
70
+ err = body.get("error") if isinstance(body, dict) else None
71
+ if not isinstance(err, dict):
72
+ err = {"code": f"http_{status}", "message": str(body)[:200] if body else ""}
73
+ cls = _BY_STATUS.get(status) or (ServiceUnavailableError if status >= 500 else ApiError)
74
+ return cls(
75
+ status,
76
+ str(err.get("code", f"http_{status}")),
77
+ str(err.get("message", "")),
78
+ err.get("request_id"),
79
+ err.get("details"),
80
+ retry_after,
81
+ )
scrapecrate/py.typed ADDED
File without changes
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.5
2
+ Name: scrapecrate
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for the ScrapeCrate API: YouTube, Google Maps, Trustpilot and Meta Ad Library data with one API key
5
+ Project-URL: Homepage, https://scrapecrate.com
6
+ Project-URL: Documentation, https://scrapecrate.com/docs/sdks
7
+ Author: ScrapeCrate
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: api,google maps,meta ad library,scraping,sdk,trustpilot,web data,youtube
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Typing :: Typed
16
+ Requires-Python: >=3.9
17
+ Requires-Dist: httpx>=0.27.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
20
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
21
+ Requires-Dist: ruff>=0.6.0; extra == 'dev'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # ScrapeCrate Python SDK
25
+
26
+ One API key for YouTube, Google Maps, Trustpilot and Meta Ad Library data.
27
+
28
+ ```bash
29
+ pip install scrapecrate
30
+ ```
31
+
32
+ ```python
33
+ from scrapecrate import ScrapeCrate
34
+
35
+ client = ScrapeCrate(api_key="YOUR_API_KEY") # or set SCRAPECRATE_API_KEY
36
+
37
+ t = client.youtube.transcript(video_id="dQw4w9WgXcQ", lang="en")
38
+ print(t.data["text"], t.credits_used, t.credits_remaining)
39
+
40
+ places = client.maps.places_search(q="coffee in Berlin", limit=20)
41
+ for review in client.maps.iterate("place_reviews", place_id=places.data[0]["id"], sort="newest"):
42
+ print(review["rating"], review["text"])
43
+ ```
44
+
45
+ - One namespace per API (`youtube`, `maps`, `trustpilot`, `ads`), one method per endpoint, same
46
+ parameter names as the HTTP API. `iterate()` follows cursors.
47
+ - `AsyncScrapeCrate` has the same methods (awaitable, `async for` with `iterate`).
48
+ - Typed errors: `ValidationError`, `AuthenticationError`, `InsufficientCreditsError`,
49
+ `PermissionDeniedError`, `NotFoundError`, `RateLimitError`, `ServiceUnavailableError` (all `ApiError`), see below.
50
+ - Retries 429/5xx with backoff (failed calls are never billed).
51
+
52
+ ## Errors
53
+
54
+ Every API error arrives as `{"error": {"code", "message", "request_id", "details"?}}` and is never billed.
55
+ The SDK raises it as a typed exception with the same fields:
56
+
57
+ ```python
58
+ from scrapecrate import ScrapeCrate, ApiError, NotFoundError, InsufficientCreditsError
59
+
60
+ client = ScrapeCrate()
61
+ try:
62
+ company = client.trustpilot.company(domain="example.com").data
63
+ except NotFoundError:
64
+ company = None # 404 not_found (or a specific *_not_found code)
65
+ except InsufficientCreditsError as e:
66
+ print(e.details) # {"required": 3, "available": 0}
67
+ except ApiError as e:
68
+ print(e.status, e.code, e.message, e.request_id, e.details, e.retry_after)
69
+ ```
70
+
71
+ | Exception | Status | Codes |
72
+ |---|---|---|
73
+ | `ValidationError` | 400 | `invalid_parameter` (`details`: `[{"param", "message"}]`), `invalid_cursor` |
74
+ | `AuthenticationError` | 401 | `missing_api_key`, `invalid_api_key` |
75
+ | `InsufficientCreditsError` | 402 | `insufficient_credits` (`details`: `{"required", "available"}`) |
76
+ | `PermissionDeniedError` | 403 | `account_disabled` |
77
+ | `NotFoundError` | 404 | `not_found`, `*_not_found` |
78
+ | `RateLimitError` | 429 | `rate_limited`, `too_many_concurrent_requests`, `insufficient_credits_retry_later` (`retry_after` set) |
79
+ | `ServiceUnavailableError` | 5xx | `source_unavailable`, `source_busy`, `source_timeout`, `source_error`, `internal_error`, `not_available` |
80
+ | `ApiError` | other | e.g. 410 `cursor_expired`, 405 `method_not_allowed` |
81
+ | `ConnectionError` | — | the API could not be reached |
82
+
83
+ 429 and 5xx answers are retried up to `max_retries` (default 3) before raising. Branch on `e.code`, not only on the
84
+ class: `not_available` (503) means the API is not launched yet and will not succeed on retry, while
85
+ `source_unavailable` is temporary. Full list: https://scrapecrate.com/docs/errors
86
+
87
+ Docs: https://scrapecrate.com/docs/sdks · API reference: https://scrapecrate.com/docs/api
88
+
89
+ ## Development
90
+
91
+ The endpoint methods are generated from the catalog: `python3 sdks/generate.py` (repo root).
92
+
93
+ ```bash
94
+ uv venv && uv pip install -e ".[dev]" && pytest
95
+ ```
@@ -0,0 +1,10 @@
1
+ scrapecrate/__init__.py,sha256=a3_hdj2gkw0jsDR5-mP6dq0CCafBhcNKYsWS-cxbj0M,761
2
+ scrapecrate/_base.py,sha256=YiYDkG9ICxZbxw2wUEYpXw7J5lziJJb5FsDa608xpaw,7837
3
+ scrapecrate/_client.py,sha256=p6NX_HEBR5nqXcQBlz048kgbpnbDfV49cE_BWQ_Pr94,2881
4
+ scrapecrate/_generated.py,sha256=gHH7ao9sn49Xgnl_hZcm1L4ftKJLD5uKAFlitCcItzM,25695
5
+ scrapecrate/errors.py,sha256=Xmp03Nh_6KUhTGnilseU33k49PebjlSCw0GulxVQro4,2132
6
+ scrapecrate/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ scrapecrate-1.0.0.dist-info/METADATA,sha256=SAa10fIAM4Us1mypdJWpwBGdJiC-Vi4IUJMj9RFFFM4,4148
8
+ scrapecrate-1.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
9
+ scrapecrate-1.0.0.dist-info/licenses/LICENSE,sha256=9ISFG7NHZ494GYu0GubVQuTDDrDTFNAhFtcueC3kq0M,1068
10
+ scrapecrate-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ScrapeCrate
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.