Skip to content

Commit 30cb1c0

Browse files
authored
Merge pull request #983 from planetlabs/issue933
Add more doc help
2 parents fea8bb6 + 90b917d commit 30cb1c0

File tree

2 files changed

+31
-16
lines changed

2 files changed

+31
-16
lines changed

planet/cli/subscriptions.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ async def get_subscription_cmd(ctx, subscription_id, pretty):
168168
'csv_flag',
169169
is_flag=True,
170170
default=False,
171-
help="Get subscription results as an unpaged CSV file.")
171+
help="Get subscription results as comma-separated fields.")
172172
@limit
173173
# TODO: the following 3 options.
174174
# –created: timestamp instant or range.
@@ -183,7 +183,26 @@ async def list_subscription_results_cmd(ctx,
183183
status,
184184
csv_flag,
185185
limit):
186-
"""Gets results of a subscription and prints the API response."""
186+
"""Print the results of a subscription to stdout.
187+
188+
The output of this command is a sequence of JSON objects (the
189+
default) or a sequence of comma-separated fields (when the --csv
190+
option is used), one result per line.
191+
192+
Examples:
193+
194+
\b
195+
planet subscriptions results SUBSCRIPTION_ID --status=success --limit 10
196+
197+
Where SUBSCRIPTION_ID is the unique identifier for a subscription,
198+
this prints the last 10 successfully delivered results for that
199+
subscription as JSON objects.
200+
201+
\b
202+
planet subscriptions results SUBSCRIPTION_ID --limit 0 --csv > results.csv
203+
204+
Prints all results for a subscription and saves them to a CSV file.
205+
"""
187206
async with subscriptions_client(ctx) as client:
188207
if csv_flag:
189208
async for result in client.get_results_csv(subscription_id,

planet/clients/subscriptions.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -268,22 +268,18 @@ class _ResultsPager(Paged):
268268
except ClientError: # pragma: no cover
269269
raise
270270

271-
async def get_results_csv(self,
272-
subscription_id: str,
273-
status: Optional[Sequence[Literal[
274-
"created",
275-
"queued",
276-
"processing",
277-
"failed",
278-
"success"]]] = None,
279-
**kwargs) -> AsyncIterator[str]:
271+
async def get_results_csv(
272+
self,
273+
subscription_id: str,
274+
status: Optional[Sequence[Literal["created",
275+
"queued",
276+
"processing",
277+
"failed",
278+
"success"]]] = None,
279+
limit: int = 100,
280+
) -> AsyncIterator[str]:
280281
"""Iterate over rows of results CSV for a Subscription.
281282
282-
Notes:
283-
The name of this method is based on the API's method name. This
284-
method provides iteration over results, it does not get a
285-
single result description or return a list of descriptions.
286-
287283
Parameters:
288284
subscription_id (str): id of a subscription.
289285
status (Set[str]): pass result with status in this set,

0 commit comments

Comments
 (0)