Skip to content

Commit 8391478

Browse files
refactor: drop Api* prefix from type aliases
Renames: - ApiService -> Service - ApiHtmlMode -> HtmlMode - ApiFetchMode -> FetchMode - ApiTimeRange -> TimeRange - ApiCrawlStatus -> CrawlStatus - ApiCrawlPageStatus -> CrawlPageStatus - ApiHistoryStatus -> HistoryStatus - ApiFetchContentType -> FetchContentType - ApiMonitorTickStatus -> MonitorTickStatus Removed (unused): - ApiStatus - ApiScrapeFormat - ApiHistoryService (duplicate of ApiService) Kept: ApiResult. The prefix earns its keep there since it's semantically distinct from the *Response types and "Result[T]" alone would be too generic. All aliases now exported from scrapegraph_py for user type annotations. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent dc1005d commit 8391478

4 files changed

Lines changed: 66 additions & 53 deletions

File tree

src/scrapegraph_py/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,24 @@
44
ApiResult,
55
BrandingFormatConfig,
66
CrawlPage,
7+
CrawlPageStatus,
78
CrawlRequest,
89
CrawlResponse,
10+
CrawlStatus,
911
CreditsResponse,
1012
ExtractRequest,
1113
ExtractResponse,
1214
FetchConfig,
15+
FetchContentType,
16+
FetchMode,
1317
FormatConfig,
1418
HealthResponse,
1519
HistoryEntry,
1620
HistoryFilter,
1721
HistoryPage,
22+
HistoryStatus,
1823
HtmlFormatConfig,
24+
HtmlMode,
1925
ImagesFormatConfig,
2026
JsonFormatConfig,
2127
LinksFormatConfig,
@@ -27,14 +33,17 @@
2733
MonitorResponse,
2834
MonitorResult,
2935
MonitorTickEntry,
36+
MonitorTickStatus,
3037
MonitorUpdateRequest,
3138
ScrapeRequest,
3239
ScrapeResponse,
3340
ScreenshotFormatConfig,
3441
SearchRequest,
3542
SearchResponse,
3643
SearchResult,
44+
Service,
3745
SummaryFormatConfig,
46+
TimeRange,
3847
TokenUsage,
3948
)
4049

@@ -52,6 +61,8 @@
5261
"CrawlRequest",
5362
"CrawlResponse",
5463
"CrawlPage",
64+
"CrawlPageStatus",
65+
"CrawlStatus",
5566
"MonitorCreateRequest",
5667
"MonitorUpdateRequest",
5768
"MonitorResponse",
@@ -60,14 +71,21 @@
6071
"MonitorActivityRequest",
6172
"MonitorActivityResponse",
6273
"MonitorTickEntry",
74+
"MonitorTickStatus",
6375
"HistoryFilter",
6476
"HistoryPage",
6577
"HistoryEntry",
78+
"HistoryStatus",
6679
"CreditsResponse",
6780
"HealthResponse",
6881
"TokenUsage",
6982
"FetchConfig",
83+
"FetchContentType",
84+
"FetchMode",
7085
"FormatConfig",
86+
"HtmlMode",
87+
"Service",
88+
"TimeRange",
7189
"MarkdownFormatConfig",
7290
"HtmlFormatConfig",
7391
"ScreenshotFormatConfig",

src/scrapegraph_py/async_client.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,20 @@
1313

1414
from .env import env
1515
from .schemas import (
16-
ApiFetchContentType,
17-
ApiHtmlMode,
1816
ApiResult,
19-
ApiService,
20-
ApiTimeRange,
2117
CrawlRequest,
2218
CrawlResponse,
2319
CreditsResponse,
2420
ExtractRequest,
2521
ExtractResponse,
2622
FetchConfig,
23+
FetchContentType,
2724
FormatConfig,
2825
HealthResponse,
2926
HistoryEntry,
3027
HistoryFilter,
3128
HistoryPage,
29+
HtmlMode,
3230
MonitorActivityRequest,
3331
MonitorActivityResponse,
3432
MonitorCreateRequest,
@@ -38,6 +36,8 @@
3836
ScrapeResponse,
3937
SearchRequest,
4038
SearchResponse,
39+
Service,
40+
TimeRange,
4141
)
4242

4343
_SERVER_TIMING_RE = re.compile(r"dur=(\d+(?:\.\d+)?)")
@@ -94,7 +94,7 @@ async def start(
9494
allow_external: bool | None = None,
9595
include_patterns: list[str] | None = None,
9696
exclude_patterns: list[str] | None = None,
97-
content_types: list[ApiFetchContentType] | None = None,
97+
content_types: list[FetchContentType] | None = None,
9898
fetch_config: FetchConfig | None = None,
9999
) -> ApiResult[CrawlResponse]:
100100
req = CrawlRequest(
@@ -217,7 +217,7 @@ async def list(
217217
*,
218218
page: int | None = None,
219219
limit: int | None = None,
220-
service: ApiService | None = None,
220+
service: Service | None = None,
221221
) -> ApiResult[HistoryPage]:
222222
kwargs = _compact(page=page, limit=limit, service=service)
223223
if not kwargs:
@@ -332,7 +332,7 @@ async def scrape(
332332
*,
333333
formats: list[FormatConfig] | None = None,
334334
fetch_config: FetchConfig | None = None,
335-
content_type: ApiFetchContentType | None = None,
335+
content_type: FetchContentType | None = None,
336336
) -> ApiResult[ScrapeResponse]:
337337
req = ScrapeRequest(
338338
**_compact(
@@ -352,9 +352,9 @@ async def extract(
352352
html: str | None = None,
353353
markdown: str | None = None,
354354
schema: dict[str, object] | None = None,
355-
mode: ApiHtmlMode | None = None,
355+
mode: HtmlMode | None = None,
356356
fetch_config: FetchConfig | None = None,
357-
content_type: ApiFetchContentType | None = None,
357+
content_type: FetchContentType | None = None,
358358
) -> ApiResult[ExtractResponse]:
359359
req = ExtractRequest(
360360
**_compact(
@@ -376,12 +376,12 @@ async def search(
376376
*,
377377
num_results: int | None = None,
378378
format: Literal["html", "markdown"] | None = None,
379-
mode: ApiHtmlMode | None = None,
379+
mode: HtmlMode | None = None,
380380
prompt: str | None = None,
381381
schema: dict[str, object] | None = None,
382382
fetch_config: FetchConfig | None = None,
383383
location_geo_code: str | None = None,
384-
time_range: ApiTimeRange | None = None,
384+
time_range: TimeRange | None = None,
385385
) -> ApiResult[SearchResponse]:
386386
req = SearchRequest(
387387
**_compact(

src/scrapegraph_py/client.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,20 @@
1313

1414
from .env import env
1515
from .schemas import (
16-
ApiFetchContentType,
17-
ApiHtmlMode,
1816
ApiResult,
19-
ApiService,
20-
ApiTimeRange,
2117
CrawlRequest,
2218
CrawlResponse,
2319
CreditsResponse,
2420
ExtractRequest,
2521
ExtractResponse,
2622
FetchConfig,
23+
FetchContentType,
2724
FormatConfig,
2825
HealthResponse,
2926
HistoryEntry,
3027
HistoryFilter,
3128
HistoryPage,
29+
HtmlMode,
3230
MonitorActivityRequest,
3331
MonitorActivityResponse,
3432
MonitorCreateRequest,
@@ -38,6 +36,8 @@
3836
ScrapeResponse,
3937
SearchRequest,
4038
SearchResponse,
39+
Service,
40+
TimeRange,
4141
)
4242

4343
_SERVER_TIMING_RE = re.compile(r"dur=(\d+(?:\.\d+)?)")
@@ -94,7 +94,7 @@ def start(
9494
allow_external: bool | None = None,
9595
include_patterns: list[str] | None = None,
9696
exclude_patterns: list[str] | None = None,
97-
content_types: list[ApiFetchContentType] | None = None,
97+
content_types: list[FetchContentType] | None = None,
9898
fetch_config: FetchConfig | None = None,
9999
) -> ApiResult[CrawlResponse]:
100100
req = CrawlRequest(
@@ -217,7 +217,7 @@ def list(
217217
*,
218218
page: int | None = None,
219219
limit: int | None = None,
220-
service: ApiService | None = None,
220+
service: Service | None = None,
221221
) -> ApiResult[HistoryPage]:
222222
kwargs = _compact(page=page, limit=limit, service=service)
223223
if not kwargs:
@@ -332,7 +332,7 @@ def scrape(
332332
*,
333333
formats: list[FormatConfig] | None = None,
334334
fetch_config: FetchConfig | None = None,
335-
content_type: ApiFetchContentType | None = None,
335+
content_type: FetchContentType | None = None,
336336
) -> ApiResult[ScrapeResponse]:
337337
req = ScrapeRequest(
338338
**_compact(
@@ -352,9 +352,9 @@ def extract(
352352
html: str | None = None,
353353
markdown: str | None = None,
354354
schema: dict[str, object] | None = None,
355-
mode: ApiHtmlMode | None = None,
355+
mode: HtmlMode | None = None,
356356
fetch_config: FetchConfig | None = None,
357-
content_type: ApiFetchContentType | None = None,
357+
content_type: FetchContentType | None = None,
358358
) -> ApiResult[ExtractResponse]:
359359
req = ExtractRequest(
360360
**_compact(
@@ -376,12 +376,12 @@ def search(
376376
*,
377377
num_results: int | None = None,
378378
format: Literal["html", "markdown"] | None = None,
379-
mode: ApiHtmlMode | None = None,
379+
mode: HtmlMode | None = None,
380380
prompt: str | None = None,
381381
schema: dict[str, object] | None = None,
382382
fetch_config: FetchConfig | None = None,
383383
location_geo_code: str | None = None,
384-
time_range: ApiTimeRange | None = None,
384+
time_range: TimeRange | None = None,
385385
) -> ApiResult[SearchResponse]:
386386
req = SearchRequest(
387387
**_compact(

0 commit comments

Comments
 (0)