Skip to content

Commit 97c8940

Browse files
add attachment url option flag (#77)
* add attachment url option flag * include test * formating * more reformatting * remove test case
1 parent c418cad commit 97c8940

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

scaleapi/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ def tasks(self, **kwargs) -> Tasklist:
269269
limit (int):
270270
Determines the page size (1-100)
271271
272+
include_attachment_url (bool):
273+
If true, returns a pre-signed s3 url for the
274+
attachment used to create the task.
275+
272276
next_token (str):
273277
Can be use to fetch the next page of tasks
274278
"""
@@ -288,6 +292,7 @@ def tasks(self, **kwargs) -> Tasklist:
288292
"updated_before",
289293
"updated_after",
290294
"unique_id",
295+
"include_attachment_url",
291296
}
292297

293298
for key in kwargs:
@@ -323,6 +328,7 @@ def get_tasks(
323328
created_after: str = None,
324329
created_before: str = None,
325330
tags: Union[List[str], str] = None,
331+
include_attachment_url: bool = True,
326332
) -> Generator[Task, None, None]:
327333
"""Retrieve all tasks as a `generator` method, with the
328334
given parameters. This methods handles pagination of
@@ -382,6 +388,11 @@ def get_tasks(
382388
The tags of a task; multiple tags can be
383389
specified as a list.
384390
391+
include_attachment_url (bool):
392+
If true, returns a pre-signed s3 url for the
393+
attachment used to create the task.
394+
395+
385396
Yields:
386397
Generator[Task]:
387398
Yields Task objects, can be iterated.
@@ -404,6 +415,7 @@ def get_tasks(
404415
created_after,
405416
created_before,
406417
tags,
418+
include_attachment_url,
407419
)
408420

409421
while has_more:
@@ -431,6 +443,7 @@ def get_tasks_count(
431443
created_after: str = None,
432444
created_before: str = None,
433445
tags: Union[List[str], str] = None,
446+
include_attachment_url: bool = True,
434447
) -> int:
435448
"""Returns number of tasks with given filters.
436449
@@ -485,6 +498,10 @@ def get_tasks_count(
485498
The tags of a task; multiple tags can be
486499
specified as a list.
487500
501+
include_attachment_url (bool):
502+
If true, returns a pre-signed s3 url for the
503+
attachment used to create the task.
504+
488505
Returns:
489506
int:
490507
Returns number of tasks
@@ -504,6 +521,7 @@ def get_tasks_count(
504521
created_after,
505522
created_before,
506523
tags,
524+
include_attachment_url,
507525
)
508526

509527
tasks_args["limit"] = 1
@@ -526,6 +544,7 @@ def _process_tasks_endpoint_args(
526544
created_after: str = None,
527545
created_before: str = None,
528546
tags: Union[List[str], str] = None,
547+
include_attachment_url: bool = True,
529548
):
530549
"""Generates args for /tasks endpoint."""
531550
tasks_args = {
@@ -539,6 +558,7 @@ def _process_tasks_endpoint_args(
539558
"updated_before": updated_before,
540559
"updated_after": updated_after,
541560
"unique_id": unique_id,
561+
"include_attachment_url": include_attachment_url,
542562
}
543563

544564
if status:

scaleapi/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "2.14.3"
1+
__version__ = "2.14.4"
22
__package_name__ = "scaleapi"

0 commit comments

Comments
 (0)