-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maxence Guindon
committed
Apr 16, 2024
1 parent
90ac116
commit a9cb91d
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from azure.storage.blob import BlobServiceClient, ContainerClient | ||
from azure.core.exceptions import ResourceNotFoundError | ||
|
||
class DatastoreErrors(Exception): | ||
pass | ||
|
||
def get_blob_client(connection: str) -> BlobServiceClient: | ||
""" | ||
Returns a BlobServiceClient object initialized with the provided connection | ||
string. | ||
Args: | ||
connection (str): The connection string for the Azure Blob Storage | ||
account. | ||
Returns: | ||
BlobServiceClient: The initialized BlobServiceClient object. | ||
Raises: | ||
DatastoreErrors: If the blob client cannot be retrieved. | ||
""" | ||
try: | ||
return BlobServiceClient.from_connection_string(connection) | ||
except ValueError as error: | ||
raise DatastoreErrors("could not retrieve the blob client") from error | ||
|
||
|
||
def get_testing_image(amount: int, blob_path: str, | ||
blob_service_client: BlobServiceClient) -> list[str]: | ||
pass | ||
|
||
|
||
def get_user_image(amount: int, blob_path: str | list, | ||
blob_service_client: BlobServiceClient) -> list[str]: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# TODO Createa connexion to azure storage that can eventually be switch to a | ||
# datastore connection | ||
|
||
# TODO Retrieve a user specified amount of testing image | ||
|
||
# TODO Retrieve a user specified amount of user image | ||
|
||
# TODO Have a datastructure for both image type | ||
|
||
# TODO have a user message displaying the end of the loading image. | ||
|
||
import os | ||
|
||
# Environment variable | ||
AZURE_STORAGE_CONNECTION_STRING = os.env("AZURE_STORAGE_CONNECTION_STRING") | ||
SEEDS_NAME = os.env("SEEDS_NAME") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters