From c1e6c8bbd31f92568c8563e774f272b762f29f44 Mon Sep 17 00:00:00 2001 From: DenisaCG Date: Mon, 16 Dec 2024 13:30:12 +0100 Subject: [PATCH 1/2] update location extraction logic --- jupyter_drives/manager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jupyter_drives/manager.py b/jupyter_drives/manager.py index 209276f..48f46af 100644 --- a/jupyter_drives/manager.py +++ b/jupyter_drives/manager.py @@ -547,12 +547,13 @@ async def _get_drive_location(self, drive_name): Args: drive_name: name of drive to get the region of """ - location = 'eu-north-1' + location = 'us-east-1' try: # set temporary client for location extraction async with self._s3_session.create_client('s3', aws_secret_access_key=self._config.secret_access_key, aws_access_key_id=self._config.access_key_id, aws_session_token=self._config.session_token) as client: result = await client.get_bucket_location(Bucket=drive_name) - location = result['LocationConstraint'] + if location is not None: + location = result['LocationConstraint'] except Exception as e: raise tornado.web.HTTPError( status_code= httpx.codes.BAD_REQUEST, From b76c0170439736f283c5292d651fb9e6b7ed8ba3 Mon Sep 17 00:00:00 2001 From: DenisaCG Date: Mon, 16 Dec 2024 13:36:40 +0100 Subject: [PATCH 2/2] iterate on location extraction --- jupyter_drives/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter_drives/manager.py b/jupyter_drives/manager.py index 48f46af..383020c 100644 --- a/jupyter_drives/manager.py +++ b/jupyter_drives/manager.py @@ -552,7 +552,7 @@ async def _get_drive_location(self, drive_name): # set temporary client for location extraction async with self._s3_session.create_client('s3', aws_secret_access_key=self._config.secret_access_key, aws_access_key_id=self._config.access_key_id, aws_session_token=self._config.session_token) as client: result = await client.get_bucket_location(Bucket=drive_name) - if location is not None: + if result['LocationConstraint'] is not None: location = result['LocationConstraint'] except Exception as e: raise tornado.web.HTTPError(