Skip to content

Commit d1ed25a

Browse files
committed
Address feedback (p2)
1 parent 86f9560 commit d1ed25a

13 files changed

Lines changed: 64 additions & 33 deletions

File tree

datamodel_codegen_aliases.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"gitHubGistUrl": "github_gist_url"
3+
}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ wrap_string_literal = true
207207
snake_case_field = true
208208
use_subclass_enum = true
209209
extra_fields = "allow"
210+
aliases = "datamodel_codegen_aliases.json"
210211
formatters = ["ruff-check", "ruff-format"]
211212

212213
# Run tasks with: uv run poe <task>

scripts/fix_async_docstrings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
# Find all classes which end with "ClientAsync" (there should be at most 1 per file)
1919
async_class = red.find('ClassNode', name=re.compile('.*ClientAsync$'))
2020

21+
if async_class is None:
22+
# No async client class in this file, nothing to fix
23+
continue
24+
2125
# Find the corresponding sync classes (same name, but without -Async)
2226
sync_class = red.find('ClassNode', name=async_class.name.replace('ClientAsync', 'Client'))
2327

src/apify_client/_http_clients/_base.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,17 @@ def _parse_params(params: dict[str, Any] | None) -> dict[str, Any] | None:
9696

9797
@staticmethod
9898
def _is_retryable_error(exc: Exception) -> bool:
99-
"""Check if an exception represents a transient error that should be retried."""
99+
"""Check if an exception represents a transient error that should be retried.
100+
101+
All ``impit.HTTPError`` subclasses are considered retryable because they represent transport-level failures
102+
(network issues, timeouts, protocol errors, body decoding errors) that are typically transient. HTTP status
103+
code errors are handled separately in ``_make_request`` based on the response status code, not here.
104+
"""
100105
return isinstance(
101106
exc,
102107
(
103108
InvalidResponseBodyError,
104-
impit.NetworkError,
105-
impit.TimeoutException,
106-
impit.RemoteProtocolError,
109+
impit.HTTPError,
107110
),
108111
)
109112

src/apify_client/_models.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: https://docs.apify.com/api/openapi.json
3-
# timestamp: 2026-02-05T12:15:43+00:00
3+
# timestamp: 2026-02-23T08:49:00+00:00
44

55
from __future__ import annotations
66

@@ -165,7 +165,7 @@ class Version(BaseModel):
165165
"""
166166
URL of the tarball when sourceType is TARBALL.
167167
"""
168-
git_hub_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None
168+
github_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None
169169
"""
170170
URL of the GitHub Gist when sourceType is GITHUB_GIST.
171171
"""
@@ -363,6 +363,10 @@ class Actor(BaseModel):
363363
deployment_key: Annotated[str | None, Field(alias='deploymentKey', examples=['ssh-rsa AAAA ...'])] = None
364364
title: Annotated[str | None, Field(examples=['My Actor'])] = None
365365
tagged_builds: Annotated[dict[str, TaggedBuildInfo | None] | None, Field(alias='taggedBuilds')] = None
366+
readme_summary: Annotated[str | None, Field(alias='readmeSummary')] = None
367+
"""
368+
A brief, LLM-generated readme summary
369+
"""
366370

367371

368372
class ActorResponse(BaseModel):
@@ -394,7 +398,7 @@ class CreateOrUpdateVersionRequest(BaseModel):
394398
"""
395399
URL of the tarball when sourceType is TARBALL.
396400
"""
397-
git_hub_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None
401+
github_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None
398402
"""
399403
URL of the GitHub Gist when sourceType is GITHUB_GIST.
400404
"""
@@ -775,7 +779,7 @@ class ActorDefinition(BaseModel):
775779
"""
776780
uses_standby_mode: Annotated[bool | None, Field(alias='usesStandbyMode')] = None
777781
"""
778-
Specifies whether the Actor will have Standby mode enabled.
782+
Specifies whether Standby mode is enabled for the Actor.
779783
"""
780784

781785

@@ -905,7 +909,7 @@ class RunOptions(BaseModel):
905909
max_total_charge_usd: Annotated[float | None, Field(alias='maxTotalChargeUsd', examples=[5], ge=0.0)] = None
906910

907911

908-
class GeneralAccessEnum(str, Enum):
912+
class GeneralAccess(str, Enum):
909913
"""Defines the general access level for the resource."""
910914

911915
ANYONE_WITH_ID_CAN_READ = 'ANYONE_WITH_ID_CAN_READ'
@@ -1070,7 +1074,7 @@ class Run(BaseModel):
10701074
"""
10711075
Exit code of the Actor run process.
10721076
"""
1073-
general_access: Annotated[GeneralAccessEnum, Field(alias='generalAccess')]
1077+
general_access: Annotated[GeneralAccess, Field(alias='generalAccess')]
10741078
"""
10751079
General access level for the Actor run.
10761080
"""
@@ -1274,7 +1278,7 @@ class UpdateRunRequest(BaseModel):
12741278
run_id: Annotated[str | None, Field(alias='runId', examples=['3KH8gEpp4d8uQSe8T'])] = None
12751279
status_message: Annotated[str | None, Field(alias='statusMessage', examples=['Actor has finished'])] = None
12761280
is_status_message_terminal: Annotated[bool | None, Field(alias='isStatusMessageTerminal', examples=[True])] = None
1277-
general_access: Annotated[GeneralAccessEnum | None, Field(alias='generalAccess')] = None
1281+
general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None
12781282

12791283

12801284
class ChargeRunRequest(BaseModel):
@@ -1332,7 +1336,7 @@ class KeyValueStore(BaseModel):
13321336
"""
13331337
A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the key-value store.
13341338
"""
1335-
general_access: Annotated[GeneralAccessEnum | None, Field(alias='generalAccess')] = None
1339+
general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None
13361340
stats: KeyValueStoreStats | None = None
13371341

13381342

@@ -1364,7 +1368,7 @@ class UpdateStoreRequest(BaseModel):
13641368
extra='allow',
13651369
)
13661370
name: str | None = None
1367-
general_access: Annotated[GeneralAccessEnum | None, Field(alias='generalAccess')] = None
1371+
general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None
13681372

13691373

13701374
class KeyValueStoreKey(BaseModel):
@@ -1522,7 +1526,7 @@ class Dataset(BaseModel):
15221526
"""
15231527
A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the dataset.
15241528
"""
1525-
general_access: Annotated[GeneralAccessEnum | None, Field(alias='generalAccess')] = None
1529+
general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None
15261530
stats: DatasetStats | None = None
15271531

15281532

@@ -1540,7 +1544,7 @@ class UpdateDatasetRequest(BaseModel):
15401544
extra='allow',
15411545
)
15421546
name: str | None = None
1543-
general_access: Annotated[GeneralAccessEnum | None, Field(alias='generalAccess')] = None
1547+
general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None
15441548

15451549

15461550
class PutItemsRequest(BaseModel):
@@ -1831,7 +1835,7 @@ class RequestQueue(BaseModel):
18311835
The URL to view the request queue in the Apify console.
18321836
"""
18331837
stats: RequestQueueStats | None = None
1834-
general_access: Annotated[GeneralAccessEnum | None, Field(alias='generalAccess')] = None
1838+
general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None
18351839

18361840

18371841
class RequestQueueResponse(BaseModel):
@@ -1853,7 +1857,7 @@ class UpdateRequestQueueRequest(BaseModel):
18531857
"""
18541858
The new name for the request queue.
18551859
"""
1856-
general_access: Annotated[GeneralAccessEnum | None, Field(alias='generalAccess')] = None
1860+
general_access: Annotated[GeneralAccess | None, Field(alias='generalAccess')] = None
18571861

18581862

18591863
class RequestDraft(BaseModel):
@@ -2584,6 +2588,10 @@ class StoreListActor(BaseModel):
25842588
"""
25852589
Whether the Actor is whitelisted for agentic payment processing.
25862590
"""
2591+
readme_summary: Annotated[str | None, Field(alias='readmeSummary')] = None
2592+
"""
2593+
A brief, LLM-generated readme summary
2594+
"""
25872595

25882596

25892597
class ListOfStoreActors(PaginationResponse):

src/apify_client/_resource_clients/dataset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import impit
2626

2727
from apify_client._consts import JsonSerializable
28-
from apify_client._models import GeneralAccessEnum
28+
from apify_client._models import GeneralAccess
2929

3030

3131
@dataclass
@@ -76,7 +76,7 @@ def get(self) -> Dataset | None:
7676
return None
7777
return DatasetResponse.model_validate(result).data
7878

79-
def update(self, *, name: str | None = None, general_access: GeneralAccessEnum | None = None) -> Dataset:
79+
def update(self, *, name: str | None = None, general_access: GeneralAccess | None = None) -> Dataset:
8080
"""Update the dataset with specified fields.
8181
8282
https://docs.apify.com/api/v2#/reference/datasets/dataset/update-dataset
@@ -695,7 +695,7 @@ async def get(self) -> Dataset | None:
695695
return None
696696
return DatasetResponse.model_validate(result).data
697697

698-
async def update(self, *, name: str | None = None, general_access: GeneralAccessEnum | None = None) -> Dataset:
698+
async def update(self, *, name: str | None = None, general_access: GeneralAccess | None = None) -> Dataset:
699699
"""Update the dataset with specified fields.
700700
701701
https://docs.apify.com/api/v2#/reference/datasets/dataset/update-dataset

src/apify_client/_resource_clients/key_value_store.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
from impit import Response
3232

33-
from apify_client._models import GeneralAccessEnum
33+
from apify_client._models import GeneralAccess
3434

3535

3636
def _parse_get_record_response(response: Response) -> Any:
@@ -87,7 +87,7 @@ def get(self) -> KeyValueStore | None:
8787
return None
8888
return KeyValueStoreResponse.model_validate(result).data
8989

90-
def update(self, *, name: str | None = None, general_access: GeneralAccessEnum | None = None) -> KeyValueStore:
90+
def update(self, *, name: str | None = None, general_access: GeneralAccess | None = None) -> KeyValueStore:
9191
"""Update the key-value store with specified fields.
9292
9393
https://docs.apify.com/api/v2#/reference/key-value-stores/store-object/update-store
@@ -470,7 +470,7 @@ async def update(
470470
self,
471471
*,
472472
name: str | None = None,
473-
general_access: GeneralAccessEnum | None = None,
473+
general_access: GeneralAccess | None = None,
474474
) -> KeyValueStore:
475475
"""Update the key-value store with specified fields.
476476

src/apify_client/_resource_clients/request_queue.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
if TYPE_CHECKING:
4343
from datetime import timedelta
4444

45-
from apify_client._models import GeneralAccessEnum
45+
from apify_client._models import GeneralAccess
4646

4747

4848
logger = logging.getLogger(__name__)
@@ -83,7 +83,7 @@ def get(self) -> RequestQueue | None:
8383
return None
8484
return RequestQueueResponse.model_validate(result).data
8585

86-
def update(self, *, name: str | None = None, general_access: GeneralAccessEnum | None = None) -> RequestQueue:
86+
def update(self, *, name: str | None = None, general_access: GeneralAccess | None = None) -> RequestQueue:
8787
"""Update the request queue with specified fields.
8888
8989
https://docs.apify.com/api/v2#/reference/request-queues/queue/update-request-queue
@@ -492,7 +492,7 @@ async def update(
492492
self,
493493
*,
494494
name: str | None = None,
495-
general_access: GeneralAccessEnum | None = None,
495+
general_access: GeneralAccess | None = None,
496496
) -> RequestQueue:
497497
"""Update the request queue with specified fields.
498498

src/apify_client/_resource_clients/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import logging
2323
from decimal import Decimal
2424

25-
from apify_client._models import GeneralAccessEnum
25+
from apify_client._models import GeneralAccess
2626
from apify_client._resource_clients import (
2727
DatasetClient,
2828
DatasetClientAsync,
@@ -73,7 +73,7 @@ def update(
7373
*,
7474
status_message: str | None = None,
7575
is_status_message_terminal: bool | None = None,
76-
general_access: GeneralAccessEnum | None = None,
76+
general_access: GeneralAccess | None = None,
7777
) -> Run:
7878
"""Update the run with the specified fields.
7979
@@ -457,7 +457,7 @@ async def update(
457457
*,
458458
status_message: str | None = None,
459459
is_status_message_terminal: bool | None = None,
460-
general_access: GeneralAccessEnum | None = None,
460+
general_access: GeneralAccess | None = None,
461461
) -> Run:
462462
"""Update the run with the specified fields.
463463

src/apify_client/_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
from http import HTTPStatus
1212
from typing import TYPE_CHECKING, Any, TypeVar
1313

14+
import impit
1415
from typing_extensions import overload
1516

17+
from apify_client.errors import InvalidResponseBodyError
18+
1619
if TYPE_CHECKING:
1720
from datetime import timedelta
1821

0 commit comments

Comments
 (0)