Skip to content

Commit 67f2116

Browse files
authored
Switch to session.client usage
1 parent 7d13359 commit 67f2116

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

examples/data_download_multiple_assets.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"""
2323
import asyncio
2424

25-
from planet import Session, DataClient
25+
from planet import Session
2626

2727
river_item_id = '20221003_002705_38_2461'
2828
river_item_type = 'PSScene'
@@ -33,7 +33,8 @@
3333
wildfire_asset_type = 'basic_analytic_4b'
3434

3535

36-
async def download_and_validate(item_id, item_type_id, asset_type_id, client):
36+
async def download_and_validate(client, item_id, item_type_id, asset_type_id):
37+
"""Activate, download, and validate an asset as a single task."""
3738
# Get asset description
3839
asset = await client.get_asset(item_type_id, item_id, asset_type_id)
3940

@@ -51,19 +52,19 @@ async def download_and_validate(item_id, item_type_id, asset_type_id, client):
5152

5253

5354
async def main():
55+
"""Download and validate assets in parallel."""
5456
async with Session() as sess:
55-
# Data client object
56-
client = DataClient(sess)
57-
# Download and validate assets in parallel
57+
client = sess.client('data')
5858
await asyncio.gather(
59-
download_and_validate(river_item_id,
59+
download_and_validate(client,
60+
river_item_id,
6061
river_item_type,
61-
river_asset_type,
62-
client),
63-
download_and_validate(wildfire_item_id,
62+
river_asset_type),
63+
download_and_validate(client,
64+
wildfire_item_id,
6465
wildfire_item_type,
65-
wildfire_asset_type,
66-
client))
66+
wildfire_asset_type)
67+
)
6768

6869

6970
if __name__ == '__main__':

0 commit comments

Comments
 (0)