parent
3d6811784c
commit
98b17b457a
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
|
||||
api_key = "oStJHnQxekNhWtxMbrfNpoSTJgDODVUiuZxPaymepeHiRbCzRNjjnpRamxUmNZDb" # Replace with your API key
|
||||
host = "http://192.168.0.153:5030" # Replace with your slskd host and port
|
||||
|
||||
headers = {
|
||||
"X-API-Key": api_key,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
# Get all searches
|
||||
url = f"{host}/api/v0/Searches"
|
||||
response = requests.get(url, headers=headers)
|
||||
|
||||
if response.status_code == 200:
|
||||
searches = response.json()
|
||||
if searches:
|
||||
print(f"Number of searches found: {len(searches)}")
|
||||
for search in searches:
|
||||
search_id = search["id"]
|
||||
print(f"Attempting to delete search {search_id}...")
|
||||
# Delete search
|
||||
delete_url = f"{host}/api/v0/Searches/{search_id}"
|
||||
delete_response = requests.delete(delete_url, headers=headers)
|
||||
if delete_response.status_code == 204:
|
||||
print(f"Search {search_id} deleted.")
|
||||
else:
|
||||
print(f"Error deleting search {search_id}: {delete_response.status_code}")
|
||||
else:
|
||||
print("No searches found.")
|
||||
else:
|
||||
print(f"Error retrieving searches: {response.status_code}")
|
||||
Loading…
Reference in new issue