mirror of
https://github.com/status-im/spiffworkflow-connector.git
synced 2025-02-22 11:38:17 +00:00
Some fixes from the code audit (#27)
This commit is contained in:
parent
7a4752498d
commit
425017cd6d
@ -22,7 +22,6 @@ class GetEmployeeInfo:
|
||||
params = {"fields": self.fields, "onlyCurrent": "true"}
|
||||
auth = (api_key, "x")
|
||||
|
||||
status_code = 0
|
||||
try:
|
||||
raw_response = requests.get(url, params, headers=headers, auth=auth)
|
||||
status_code = raw_response.status_code
|
||||
|
@ -16,7 +16,6 @@ class BaseCommand:
|
||||
response = '{"result": "ok"}'
|
||||
status = 200
|
||||
except Exception as e:
|
||||
raise e
|
||||
status = 500
|
||||
# TODO: better error message, e has no reason and str repr contains quotes
|
||||
response = '{"error": "Error executing sql statement"}'
|
||||
@ -56,7 +55,7 @@ class BaseCommand:
|
||||
if len(where_configs) == 0:
|
||||
return "", None
|
||||
|
||||
operators = set(["=", "!=", "<", ">"])
|
||||
operators = {"=", "!=", "<", ">"}
|
||||
|
||||
def build_where_part(where_config):
|
||||
column, operator, value = where_config
|
||||
|
@ -45,7 +45,6 @@ class SendMessage:
|
||||
"id": 1,
|
||||
}
|
||||
|
||||
status_code = 0
|
||||
try:
|
||||
raw_response = requests.post(url, json.dumps(request_body), headers=headers)
|
||||
status_code = raw_response.status_code
|
||||
|
@ -196,7 +196,7 @@ class CreateInvoice:
|
||||
api_client.refresh_oauth2_token()
|
||||
|
||||
api_instance = AccountingApi(api_client)
|
||||
summarize_errors = "True"
|
||||
summarize_errors = True
|
||||
unitdp = 2
|
||||
date_value = datetime.now()
|
||||
due_date_value = date_value + timedelta(days=7)
|
||||
@ -242,7 +242,7 @@ class CreateInvoice:
|
||||
status = 200
|
||||
except Exception as e:
|
||||
# TODO better error logging/reporting in debug
|
||||
response = f'{{ "error": "{e.reason}" }}'
|
||||
response = f'{{ "error": "{e}" }}'
|
||||
status = 500
|
||||
|
||||
return {"response": response, "status": status, "mimetype": "application/json"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user