-
Notifications
You must be signed in to change notification settings - Fork 14
feat: add started_before and started_after to run list #513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,8 @@ | |
| from apify_client.clients.base import ResourceCollectionClient, ResourceCollectionClientAsync | ||
|
|
||
| if TYPE_CHECKING: | ||
| from datetime import datetime | ||
|
|
||
| from apify_shared.consts import ActorJobStatus | ||
|
|
||
| from apify_client.clients.base.resource_collection_client import ListPage | ||
|
|
@@ -25,6 +27,8 @@ def list( | |
| offset: int | None = None, | ||
| desc: bool | None = None, | ||
| status: ActorJobStatus | list[ActorJobStatus] | None = None, | ||
| started_before: str | datetime | None = None, | ||
| started_after: str | datetime | None = None, | ||
| ) -> ListPage[dict]: | ||
| """List all Actor runs. | ||
|
|
||
|
|
@@ -39,6 +43,8 @@ def list( | |
| offset: What run to include as first when retrieving the list. | ||
| desc: Whether to sort the runs in descending order based on their start date. | ||
| status: Retrieve only runs with the provided statuses. | ||
| started_before: Only return runs started before this date (inclusive). | ||
| started_after: Only return runs started after this date (inclusive). | ||
|
|
||
| Returns: | ||
| The retrieved Actor runs. | ||
|
|
@@ -53,6 +59,8 @@ def list( | |
| offset=offset, | ||
| desc=desc, | ||
| status=status_param, | ||
| startedBefore=started_before, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure what is the best way to handle camelCase translation here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do this for other parameters as well, so I believe it'll work 😄 (you can test it on a beta release, once this is merged) |
||
| startedAfter=started_after, | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -70,6 +78,8 @@ async def list( | |
| offset: int | None = None, | ||
| desc: bool | None = None, | ||
| status: ActorJobStatus | list[ActorJobStatus] | None = None, | ||
| started_before: str | datetime | None = None, | ||
| started_after: str | datetime | None = None, | ||
| ) -> ListPage[dict]: | ||
| """List all Actor runs. | ||
|
|
||
|
|
@@ -84,6 +94,8 @@ async def list( | |
| offset: What run to include as first when retrieving the list. | ||
| desc: Whether to sort the runs in descending order based on their start date. | ||
| status: Retrieve only runs with the provided statuses. | ||
| started_before: Only return runs started before this date (inclusive). | ||
| started_after: Only return runs started after this date (inclusive). | ||
|
|
||
| Returns: | ||
| The retrieved Actor runs. | ||
|
|
@@ -98,4 +110,6 @@ async def list( | |
| offset=offset, | ||
| desc=desc, | ||
| status=status_param, | ||
| startedBefore=started_before, | ||
| startedAfter=started_after, | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only replaces the timezone without actually computing the difference, right?
So if I e.g. submit a
datetime.now()to this method, I would only get runs from two hours in the future (I'm on Central European Summer Time).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I refactored it to use
astimezone