summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Näslund <victor@sunet.se>2022-11-16 20:44:34 +0100
committerVictor Näslund <victor@sunet.se>2022-11-16 20:44:34 +0100
commit009040772ed47aa59d63d27e0ec377013cebf90a (patch)
tree31871d28f89a41966f2f36f4db5ecccb3670e946
parent210467cc289e31fabef9e8eef78a07d5818d7513 (diff)
typos
-rw-r--r--src/soc_collector/soc_collector_cli.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/soc_collector/soc_collector_cli.py b/src/soc_collector/soc_collector_cli.py
index f9b0fad..914db17 100644
--- a/src/soc_collector/soc_collector_cli.py
+++ b/src/soc_collector/soc_collector_cli.py
@@ -26,7 +26,7 @@ def json_load_data(data: str) -> Dict[str, Any]:
ret: Dict[str, Any]
try:
- if isfile(data):
+ if data and isfile(data):
with open(data, encoding="utf-8") as f_data:
ret = json.loads(f_data.read())
else:
@@ -77,7 +77,7 @@ def delete_action(data: str) -> None:
:param data: key or path to a json file containing "_id".
"""
- if isfile(data):
+ if data and isfile(data):
data = json_load_data(data)["_id"]
req = requests.delete(f"{API_URL}/sc/v0/{data}", headers={"API-KEY": API_KEY}, timeout=5, verify=ROOT_CA_FILE)
@@ -143,7 +143,7 @@ def insert_action(data: str) -> None:
# Ensure ok status
req.raise_for_status()
- data = json.loads(req.text)
+ json_data = json.loads(req.text)
print(f'Inserted data OK - key: {json_data["_id"]}')
@@ -152,7 +152,7 @@ def get_action(data: str) -> None:
:param data: key or path to a json file containing "_id".
"""
- if isfile(data):
+ if data and isfile(data):
data = json_load_data(data)["_id"]
req = requests.get(f"{API_URL}/sc/v0/{data}", headers={"API-KEY": API_KEY}, timeout=5, verify=ROOT_CA_FILE)