Skip to content

Commit

Permalink
chore: remove logger
Browse files Browse the repository at this point in the history
  • Loading branch information
bathienle committed Oct 29, 2024
1 parent 990348e commit c5844ec
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions pims/api/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
router = APIRouter()

cytomine_logger = logging.getLogger("pims.cytomine")
logger = logging.getLogger("pims")

REQUIRED_DIRECTORIES = ["images", "metadata"]
WRITING_PATH = get_settings().writing_path
Expand Down Expand Up @@ -108,27 +107,23 @@ def import_dataset(
and is_dataset_structured(dataset_path)
]

logger.info(f"Parse headers from request: {request.headers}")
public_key, signature = parse_authorization_header(request.headers)
cytomine_auth = (host, config.cytomine_public_key, config.cytomine_private_key)

with Cytomine(*cytomine_auth, configure_logging=False) as c:
logger.info(f"Logged as {c}")
if not c.current_user:
raise AuthenticationException("PIMS authentication to Cytomine failed.")

this = get_this_image_server(config.pims_url)
cyto_keys = c.get(f"userkey/{public_key}/keys.json")
private_key = cyto_keys["privateKey"]

logger.info(f"SIG {sign_token(private_key, parse_request_token(request))} == {signature}")
if sign_token(private_key, parse_request_token(request)) != signature:
raise AuthenticationException("Authentication to Cytomine failed")

c.set_credentials(public_key, private_key)
user = c.current_user

logger.info(f"Get storage {storage_id}")
storage = Storage().fetch(storage_id)
if not storage:
raise CytomineProblem(f"Storage {storage_id} not found")
Expand Down

0 comments on commit c5844ec

Please sign in to comment.