You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
#!/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}")
|