Skip to content

Commit 28102fe

Browse files
authored
fix: Fix return type of charge API call (#350)
In the current state, the API call crashes because the `data` field is not present in the response.
1 parent 1173df4 commit 28102fe

File tree

1 file changed

+4
-6
lines changed
  • src/apify_client/clients/resource_clients

1 file changed

+4
-6
lines changed

src/apify_client/clients/resource_clients/run.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def charge(
232232
event_name: str,
233233
count: int | None = None,
234234
idempotency_key: str | None = None,
235-
) -> dict:
235+
) -> None:
236236
"""Charge for an event of a Pay-Per-Event Actor run.
237237
238238
https://docs.apify.com/api/v2#/reference/actor-runs/charge-events-in-run
@@ -248,7 +248,7 @@ def charge(
248248
or f'{self.resource_id}-{event_name}-{int(time.time() * 1000)}-{"".join(random.choices(string.ascii_letters + string.digits, k=6))}' # noqa: E501
249249
)
250250

251-
response = self.http_client.call(
251+
self.http_client.call(
252252
url=self._url('charge'),
253253
method='POST',
254254
headers={
@@ -262,7 +262,6 @@ def charge(
262262
}
263263
),
264264
)
265-
return parse_date_fields(pluck_data(response.json()))
266265

267266

268267
class RunClientAsync(ActorJobBaseClientAsync):
@@ -486,7 +485,7 @@ async def charge(
486485
event_name: str,
487486
count: int | None = None,
488487
idempotency_key: str | None = None,
489-
) -> dict:
488+
) -> None:
490489
"""Charge for an event of a Pay-Per-Event Actor run.
491490
492491
https://docs.apify.com/api/v2#/reference/actor-runs/charge-events-in-run
@@ -501,7 +500,7 @@ async def charge(
501500
f'{self.resource_id}-{event_name}-{int(time.time() * 1000)}-{"".join(random.choices(string.ascii_letters + string.digits, k=6))}' # noqa: E501
502501
)
503502

504-
response = await self.http_client.call(
503+
await self.http_client.call(
505504
url=self._url('charge'),
506505
method='POST',
507506
headers={
@@ -515,4 +514,3 @@ async def charge(
515514
}
516515
),
517516
)
518-
return parse_date_fields(pluck_data(response.json()))

0 commit comments

Comments
 (0)