Skip to content

Commit

Permalink
fix: update eodag.rest imports (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato authored Apr 26, 2024
1 parent b6bd6ac commit b0da177
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions eodag_labextension/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import tornado
from eodag import EODataAccessGateway, SearchResult
from eodag.api.core import DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE
from eodag.rest.utils import get_datetime
from eodag.utils import parse_qs
from eodag.utils.exceptions import (
AuthenticationError,
Expand All @@ -20,6 +19,7 @@
UnsupportedProvider,
ValidationError,
)
from eodag.utils.rest import get_datetime
from jupyter_server.base.handlers import APIHandler
from jupyter_server.utils import url_path_join
from shapely.geometry import shape
Expand Down Expand Up @@ -131,8 +131,8 @@ def get(self):
provider = query_dict.pop("provider")[0]
provider = None if not provider or provider == "null" else provider

returned_product_types = []
try:
returned_product_types = []
# fetch all product types
all_product_types = eodag_api.list_product_types(provider=provider)

Expand All @@ -156,9 +156,9 @@ def get(self):

# 3. Append guessed product types
guess_kwargs = {}
# ["aa bb", "cc-dd_ee"] to "*aa* *bb* *cc* **dd* *ee*"
# ["aa bb", "cc-dd_ee"] to "*aa* AND *bb* AND *cc-dd_ee*"
for k, v in query_dict.items():
guess_kwargs[k] = re.sub(r"(\S+)", r"*\1*", " ".join(v).replace("-", " ").replace("_", " "))
guess_kwargs[k] = " AND ".join(re.sub(r"(\S+)", r"*\1*", " ".join(v)).split(" "))

# guessed product types ids
guessed_ids_list = eodag_api.guess_product_type(**guess_kwargs)
Expand All @@ -173,7 +173,7 @@ def get(self):

self.write(orjson.dumps(returned_product_types))
except NoMatchingProductType:
self.write(orjson.dumps([]))
self.write(orjson.dumps(returned_product_types))
except UnsupportedProvider as e:
self.set_status(400)
self.finish({"error": str(e)})
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"jupyterlab~=3.0",
"tornado>=6.0.3,<7.0.0",
"notebook>=6.0.3,<7.0.0",
"eodag[notebook]>=2.8.0",
"eodag[notebook] @ git+https://github.com/CS-SI/eodag.git@develop",
"orjson",
],
extras_require={"dev": ["black", "pre-commit", "pytest", "shapely"]},
Expand Down

0 comments on commit b0da177

Please sign in to comment.