Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion src/cript/api/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def __init__(self, host: str = None, token: str = None, tls: bool = True):
try:
response = self.session.get(f"{self.url}/session-info/")
except Exception as e:
raise APIError("Connection API failed, please review your host and token") from e
raise APIError(
"Connection API failed, please review your host and token"
) from e
if response.status_code == 200:
response_json = response.json()
self.latest_api_version = response_json["latest_version"]
Expand Down
20 changes: 20 additions & 0 deletions src/cript/data_model/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re
import warnings
from cript.exceptions import CRIPTError


Expand All @@ -9,6 +11,24 @@ class UniqueNodeError(CRIPTError):

def __init__(self, message):
self.message = message
self.existing_url = None
url_find_pattern = (
r"[(https://)|\w]*?[\w]*\.[-/\w]*\.\w*[(/{1})]?[#-\./\w]*[(/{1,})]?"
)
all_urls = re.findall(url_find_pattern, message)
if len(all_urls) > 0:
if len(all_urls) > 1:
warning.warn(
"UniqueNodeError found more than one possible URL of a unique node. Please report this bug here: https://github.com/C-Accel-CRIPT/cript/issues Thank you."
)
self.existing_url = all_urls[0]
while self.existing_url[-1] == ".":
self.existing_url = self.existing_url[:-1]

if self.existing_url is None:
warnings.warn(
"UniqueNodeError failed to extract unique URL of existing node, please report this bug here: https://github.com/C-Accel-CRIPT/cript/issues Thank you."
)

def __str__(self):
return self.message
Expand Down
6 changes: 5 additions & 1 deletion src/cript/storage_clients/globus.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
from globus_sdk.scopes import ScopeBuilder

from cript.data_model.nodes.base_node import BaseNode
from cript.storage_clients.exceptions import InvalidAuthCode, FileUploadError, FileDownloadError
from cript.storage_clients.exceptions import (
InvalidAuthCode,
FileUploadError,
FileDownloadError,
)


logger = getLogger(__name__)
Expand Down