Implemented the "payee del" action
This commit is contained in:
14
starling
14
starling
@@ -129,8 +129,16 @@ class StarlingClient:
|
|||||||
response = requests.put(url, json=data, headers=headers)
|
response = requests.put(url, json=data, headers=headers)
|
||||||
return self.parse_response(response)
|
return self.parse_response(response)
|
||||||
|
|
||||||
|
def delete(self, path, token='main'):
|
||||||
|
url = f'{base_url}/{path}'
|
||||||
|
headers = {
|
||||||
|
'Authorization': f'Bearer {self.tokens[token]}',
|
||||||
|
}
|
||||||
|
response = requests.delete(url, headers=headers)
|
||||||
|
return self.parse_response(response)
|
||||||
|
|
||||||
def parse_response(self, response):
|
def parse_response(self, response):
|
||||||
if response.status_code != requests.codes.ok:
|
if response.status_code < 200 or response.status_code > 299:
|
||||||
print(f'ERROR: got HTTP status code {response.status_code}')
|
print(f'ERROR: got HTTP status code {response.status_code}')
|
||||||
print(f'Request: {response.request}')
|
print(f'Request: {response.request}')
|
||||||
print(f'Response:')
|
print(f'Response:')
|
||||||
@@ -257,6 +265,10 @@ class StarlingClient:
|
|||||||
print(f'Failed to create payee: {response}')
|
print(f'Failed to create payee: {response}')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
def payee_del(self, payee_uid):
|
||||||
|
response = self.delete(f'payees/{payee_uid}')
|
||||||
|
print(response)
|
||||||
|
|
||||||
def account_add(self):
|
def account_add(self):
|
||||||
details = self.new_account_form.complete()
|
details = self.new_account_form.complete()
|
||||||
data = {
|
data = {
|
||||||
|
|||||||
Reference in New Issue
Block a user