22import requests
33import time
44
5+
56from api .api_types import Search , Opportunity , OpportunityCollection , Product , Provider
67
78
@@ -58,6 +59,7 @@ def get_imaging_windows(planet_request) -> list:
5859 elif status == 'FAILED' :
5960 raise ValueError (
6061 f"Retrieving Imaging Windows failed: { r .json ['error_code' ]} - { r .json ['error_message' ]} '" )
62+ # todo async
6163 time .sleep (1 )
6264
6365
@@ -72,10 +74,9 @@ def imaging_window_to_opportunity(iw, geom, search_request) -> Opportunity:
7274 id = iw ["id" ],
7375 geometry = geom ,
7476 properties = {
75- 'title' : '' ,
77+ 'title' : 'Planet Assured Imaging Window @ ' + iw ['start_time' ],
78+ 'datetime' : f"{ iw ['start_time' ]} /{ iw ['end_time' ]} " ,
7679 'product_id' : search_request .product_id ,
77- 'start_datetime' : iw ['start_time' ],
78- 'end_datetime' : iw ['end_time' ],
7980 'constraints' : {
8081 'off_nadir' : [iw ['start_off_nadir' ], iw ['end_off_nadir' ]],
8182 'cloud_cover' : iw ['cloud_forecast' ][0 ]['prediction' ]
@@ -109,7 +110,7 @@ async def find_opportunities(
109110
110111 async def find_products (self , token : str ) -> list [Product ]:
111112 # todo: get real list of products
112- # todo: consider proper reactions for all types of products
113+ # todo: consider proper reactions for all types of products (i.e. non-assured)
113114 return [
114115 Product (
115116 type = "Product" ,
@@ -125,6 +126,4 @@ async def find_products(self, token: str) -> list[Product]:
125126 constraints = {},
126127 parameters = {}
127128 )
128- ]
129-
130-
129+ ]
0 commit comments