Skip to main content

Blob mapping utility

When your code needs to access many mapped blobs as a mounted folder, the utility to make translation between blob urls and filepaths easier was made. It can be configured using the configuration json file.

You can also use this utility to download and uploads the blobs to/from the local file system without having to worry about the filepaths.

Configuration file example:

{
  "blob_mounting_configurations": [
    {
      "storage_account_name": "examplestagingstrgacc",
      "storage_account_url": "https://examplestagingstrgacc.blob.core.windows.net/",
      "container_name": "example-container-raw",
      "mount_point": "/mnt/example-container-raw"
    }
  ]
}

How to use

from blob_mounting_helper_utility import BlobMappingUtility
json_config_file = "blob_mapping_config.json"

# read the file into a dictionary
with open(json_config_file) as json_file:
    config = json.load(json_file)["blob_mounting_configurations"]

# create the utility object
blob_mapping_utility = BlobMappingUtility(config)

filepath1 = "/mnt/example-container-raw/cool_picture.png
blob_url = blob_mapping_utility.get_url_from_mounted_filepath(filepath1) # -> https://examplestagingstrgacc.blob.core.windows.net/example-container-raw/cool_picture.png

filepath2 = get_mounted_filepath_from_url(blob_url) # -> /mnt/example-container-raw/cool_picture.png

Also, if you were to pass the azure storage account key you can download and upload the blob to a local file path:

from blob_mounting_helper_utility import BlobMappingUtility
json_config_file = "blob_mapping_config.json"

# read the file into a dictionary
with open(json_config_file) as json_file:
    config = json.load(json_file)["blob_mounting_configurations"]

azure_storage_account_key = "example_key"
# create the utility object
blob_mapping_utility = BlobMappingUtility(config, azure_storage_account_key)
url = "https://examplestagingstrgacc.blob.core.windows.net/example-container-raw/cool_picture.png"
blob_mapping_utility.download_blob(url) # -> Downloads the blob to the local file path "/mnt/example-container-raw/cool_picture.png"
local_filepath = "/mnt/example-container-raw/cool_picture.png"
do_something_to_file(local_filepath)
blob_mapping_utility.upload_blob(local_filepath) # -> Uploads the file to the blob url
blob_mapping_utility.cleanup_files() # cleans both downloaded and uploaded files from the local file system

Metadata

Release files for blob-mounting-helper-utility 1.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blob-mounting-helper-utility 1.1.4
File Size Uploaded Provenance Actions
blob_mounting_helper_utility-1.1.4.tar.gz 4.3 kB Without provenance Details for blob_mounting_helper_utility-1.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blob-mounting-helper-utility 1.1.4
File Interpreter ABI Platform Actions
blob_mounting_helper_utility-1.1.4-py3-none-any.whl Python 3 none any Details for blob_mounting_helper_utility-1.1.4-py3-none-any.whl

Total release size: 9.1 kB

Release files / blob_mounting_helper_utility-1.1.4.tar.gz

Download URL blob_mounting_helper_utility-1.1.4.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f8fcb3de089aefa9c854a4f51aade364beaa8be3d356c69d7a54e9bbf4c67bfd
BLAKE2b-256 checksum
How to use checksums
22e809a27b4fb00fed393f02198d8a36e576a8b999ef97874f50f4e4a7d8ac73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / blob_mounting_helper_utility-1.1.4-py3-none-any.whl

Download URL blob_mounting_helper_utility-1.1.4-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d554de9a91a4abf7ed2f3e48a9673aadade4a000839a6aea4d5973fa0412ec53
BLAKE2b-256 checksum
How to use checksums
a35eb3d100f6297d5c1b4873387379a4089db6365baea76547ec02577e4d50b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for blob-mounting-helper-utility 1.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page