Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: adapt to eodag v3 #153

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: '18.x'
- name: Install Python
uses: actions/setup-python@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ setup_logging(1) # 0: nothing, 1: only progress bars, 2: INFO, 3: DEBUG

dag = EODataAccessGateway()
geometry = "POLYGON ((0.550136 43.005451, 0.550136 44.151469, 2.572104 44.151469, 2.572104 43.005451, 0.550136 43.005451))"
search_results, total_count = dag.search(
search_results = dag.search(
productType="S2_MSI_L1C",
geom=geometry,
start="2021-08-01",
Expand Down
4 changes: 2 additions & 2 deletions eodag_labextension/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def post(self, product_type):
arguments = dict((k, v) for k, v in arguments.items() if v is not None)

try:
products, total = eodag_api.search(productType=product_type, **arguments)
products = eodag_api.search(productType=product_type, count=True, **arguments)
except ValidationError as e:
self.set_status(400)
self.finish({"error": e.message})
Expand Down Expand Up @@ -243,7 +243,7 @@ def post(self, product_type):
"properties": {
"page": int(arguments.get("page", DEFAULT_PAGE)),
"itemsPerPage": DEFAULT_ITEMS_PER_PAGE,
"totalResults": total,
"totalResults": products.number_matched,
}
}
)
Expand Down
2 changes: 1 addition & 1 deletion notebooks/user_manual.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"\n",
"dag = EODataAccessGateway()\n",
"geometry = \"POLYGON ((0.550136 43.005451, 0.550136 44.151469, 2.572104 44.151469, 2.572104 43.005451, 0.550136 43.005451))\"\n",
"search_results, total_count = dag.search(\n",
"search_results = dag.search(\n",
" productType=\"S2_MSI_L1C\",\n",
" geom=geometry,\n",
" start=\"2022-11-01\",\n",
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] @ git+https://github.com/CS-SI/eodag.git@develop",
"eodag[notebook]>=3.0.0b1",
"orjson",
],
extras_require={
Expand Down
2 changes: 1 addition & 1 deletion src/CodeGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ${standardMessage}`
geometry = "${geojsonToWKT(geometry)}"`;
}
code += `
search_results, total_count = dag.search(`;
search_results = dag.search(`;
if (provider) {
code += `
provider="${provider}",`;
Expand Down
4 changes: 3 additions & 1 deletion tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_get_not_found(self):
def test_post_not_found(self):
self.fetch_results_error("/eodag/foo/bar", 404, method="POST", body=json.dumps({}))

@mock.patch("eodag.api.core.EODataAccessGateway.search", autospec=True, return_value=(SearchResult([]), 0))
@mock.patch("eodag.api.core.EODataAccessGateway.search", autospec=True, return_value=SearchResult([], 0))
def test_search(self, mock_search):
geom_dict = {
"type": "Polygon",
Expand Down Expand Up @@ -181,6 +181,7 @@ def test_search(self, mock_search):
cloudCover=50,
foo="bar",
provider="cop_dataspace",
count=True,
)
self.assertDictEqual(
result,
Expand All @@ -205,6 +206,7 @@ def test_search(self, mock_search):
mock_search.assert_called_once_with(
mock.ANY,
productType="S2_MSI_L1C",
count=True,
)

# date error
Expand Down
Loading