Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/cript/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def get_vocab_by_category(self, category: VocabCategories) -> List[dict]:
return self._vocabulary[category.value]

# if vocabulary category is not in cache, then get it from API and cache it
response = requests.get(f"{self.host}/cv/{category.value}").json()
response = requests.get(f"{self.host}/cv/{category.value}/").json()

if response["code"] != 200:
# TODO give a better CRIPT custom Exception
Expand Down Expand Up @@ -636,7 +636,7 @@ def _internal_save(self, node, save_values: Optional[_InternalSaveValues] = None

# This checks if the current node exists on the back end.
# if it does exist we use `patch` if it doesn't `post`.
test_get_response: Dict = requests.get(url=f"{self._host}/{node.node_type_snake_case}/{str(node.uuid)}", headers=self._http_headers).json()
test_get_response: Dict = requests.get(url=f"{self._host}/{node.node_type_snake_case}/{str(node.uuid)}/", headers=self._http_headers).json()
patch_request = test_get_response["code"] == 200

# TODO remove once get works properly
Expand All @@ -652,9 +652,9 @@ def _internal_save(self, node, save_values: Optional[_InternalSaveValues] = None
break

if patch_request:
response: Dict = requests.patch(url=f"{self._host}/{node.node_type_snake_case}/{str(node.uuid)}", headers=self._http_headers, data=json_data).json() # type: ignore
response: Dict = requests.patch(url=f"{self._host}/{node.node_type_snake_case}/{str(node.uuid)}/", headers=self._http_headers, data=json_data).json() # type: ignore
else:
response: Dict = requests.post(url=f"{self._host}/{node.node_type_snake_case}", headers=self._http_headers, data=json_data).json() # type: ignore
response: Dict = requests.post(url=f"{self._host}/{node.node_type_snake_case}/", headers=self._http_headers, data=json_data).json() # type: ignore

# If we get an error we may be able to fix, we to handle this extra and save the bad node first.
# Errors with this code, may be fixable
Expand Down