Add delete method

blocklist_example
Julian-Samuel Gebühr 2023-01-11 19:19:14 +01:00
parent 1b1cf765be
commit 5b7347ce71
1 changed files with 8 additions and 0 deletions

View File

@ -72,6 +72,14 @@ class Instance:
response = requests.put(f'https://{server}/api/v1/admin/domain_blocks/{block_id}', data=data, headers=headers)
if response.status_code != 200:
raise ConnectionError(f"Could not apply block ({response.status_code}: {response.reason})")
def delete(self, server: str, token: str):
headers = {
f'Authorization': f'Bearer {token}',
}
response = requests.delete(f'https://{server}/api/v1/admin/domain_blocks/{self.id}', headers=headers)
if response.status_code != 200:
raise ConnectionError(f"Could not apply block ({response.status_code}: {response.reason})")
@staticmethod
def list_diffs(local_blocklist, remote_blocklist):