dz1-spatial-query/tools/del_items.py

16 lines
407 B
Python
Raw Permalink Normal View History

2025-07-03 20:29:02 +08:00
import requests
STAC_API_URL = "http://localhost:8082"
COLLECTION_ID = "geosat1"
def delete_item(item_id):
url = f"{STAC_API_URL}/collections/{COLLECTION_ID}/items/{item_id}"
r = requests.delete(url)
if r.status_code in [200, 204]:
print(f"✅ 已成功删除: {item_id}")
else:
print(f"❌ 删除失败: {item_id} | {r.status_code} - {r.text}")
delete_item("TCI_right")