Add delete method
This commit is contained in:
parent
1b1cf765be
commit
5b7347ce71
@ -72,6 +72,14 @@ class Instance:
|
|||||||
response = requests.put(f'https://{server}/api/v1/admin/domain_blocks/{block_id}', data=data, headers=headers)
|
response = requests.put(f'https://{server}/api/v1/admin/domain_blocks/{block_id}', data=data, headers=headers)
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
raise ConnectionError(f"Could not apply block ({response.status_code}: {response.reason})")
|
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
|
@staticmethod
|
||||||
def list_diffs(local_blocklist, remote_blocklist):
|
def list_diffs(local_blocklist, remote_blocklist):
|
||||||
|
Loading…
Reference in New Issue
Block a user