Skip to content

Commit a810448

Browse files
committed
update docs to renamed generator functions and usage
1 parent 3fe5d50 commit a810448

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

docs/get-started/upgrading.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ For more information about Session, refer to the [Python SDK User Guide](../../p
3535

3636
With the V1 client, all communication was synchronous. Asynchronous bulk support was provided with the `downloader` module. There was no built-in support for polling when an order was ready to download or tracking when an order was downloaded.
3737

38-
In V2, all `*Client` methods (for example, `DataClient().search_aiter`, `OrderClient().create_order`) are asynchronous. Any functions that call such methods must include `async` in their definition. To invoke asynchronous methods from synchronous code, you can wrap the async method calls in `asyncio.run()`. The following is an example of using async with session.
38+
In V2, all `*Client` methods (for example, `DataClient().search`, `OrderClient().create_order`) are asynchronous. Any functions that call such methods must include `async` in their definition. To invoke asynchronous methods from synchronous code, you can wrap the async method calls in `asyncio.run()`. The following is an example of using async with session.
3939

4040
```python
4141
import asyncio
@@ -49,8 +49,7 @@ async def do_search():
4949
date_filter = filters.date_range_filter('acquired', gte=datetime.fromisoformat("2022-11-18"), lte=datetime.fromisoformat("2022-11-21"))
5050
cloud_filter = filters.range_filter('cloud_cover', lte=0.1)
5151
download_filter = filters.permission_filter()
52-
search_results = await client.search(["PSScene"], filters.and_filter([date_filter, cloud_filter, download_filter]))
53-
return [item async for item in search_results]
52+
return [item async for item in client.search(["PSScene"], filters.and_filter([date_filter, cloud_filter, download_filter]))]
5453

5554
items = asyncio.run(do_search())
5655
```
@@ -74,8 +73,8 @@ planet.api.ClientV1().quick_search(filters.build_search_request(all_filters, ["P
7473
Is now
7574

7675
```python
77-
async with Session() as session:
78-
items_aiter = planet.DataClient(session).search_aiter(["PSScene"], all_filters)
76+
async with Session() as session:
77+
items = [i async for i in planet.DataClient(session).search(["PSScene"], all_filters)]
7978
```
8079

8180
## Orders API

docs/python/sdk-guide.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ from planet import collect, OrdersClient, Session
268268
async def main():
269269
async with Session() as sess:
270270
client = OrdersClient(sess)
271-
orders_aiter = client.list_orders_aiter()
272-
orders_list = collect(orders_aiter)
271+
orders_list = collect(client.list_orders())
273272

274273
asyncio.run(main())
275274

@@ -278,7 +277,7 @@ asyncio.run(main())
278277
Alternatively, these results can be converted to a list directly with
279278

280279
```python
281-
orders_list = [o async for o in client.list_orders_aiter()]
280+
orders_list = [o async for o in client.list_orders()]
282281
```
283282

284283
## Query the data catalog
@@ -341,7 +340,7 @@ the context of a `Session` with the `DataClient`:
341340
async def main():
342341
async with Session() as sess:
343342
cl = DataClient(sess)
344-
items = await cl.search(['PSScene'], sfilter)
343+
items = [i async for i in cl.search(['PSScene'], sfilter)]
345344

346345
asyncio.run(main())
347346
```

0 commit comments

Comments
 (0)