Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a custom urllib handler for azure blob storage #510

Open
lorengordon opened this issue Feb 6, 2018 · 5 comments
Open

Create a custom urllib handler for azure blob storage #510

lorengordon opened this issue Feb 6, 2018 · 5 comments
Assignees

Comments

@lorengordon
Copy link
Member

lorengordon commented Feb 6, 2018

Example of how we're doing it for S3. Looking for a comparable method for Azure...

@Larz98
Copy link

Larz98 commented May 19, 2020

Hey @lorengordon

"blob" not "blog" storage?

In the past, I got around the Azure DEBUG default in BlobServiceClient by resetting the logging basicConfig, which uses INFO if not defined:

def main():
  global logger

  args = parse_arguments()
  logging.basicConfig(format='%(levelname)s:%(asctime)s %(message)s')
  logger = logging.getLogger(__name__)
  logger.setLevel(level=getattr(logging, args.log_level.upper()))

@lorengordon lorengordon changed the title Create a custom urllib handler for azure blog storage Create a custom urllib handler for azure blob storage May 19, 2020
@lorengordon
Copy link
Member Author

@Larz98! I would gladly accept debug logging, if it meant we could retrieve files from azure similar to how we can retrieve them from s3. :)

@ferricoxide
Copy link
Member

This issue is pretty old (opened in 2018) and last activity was the 05/2020 comments: can it be closed/is it "OBE"?

@lorengordon
Copy link
Member Author

Still valid

@Larz98
Copy link

Larz98 commented Jul 26, 2023

Below are snippets from an old ci/cd script used (pre2020 py27) to pull from hdfs and upload to azure blob storage (can't share the full script, but pulled pieces from functions in the old script which could be useful here?):

Can look into download-blob instead of upload-blob.

from azure.storage.blob import BlobServiceClient
from azure.identity import ClientSecretCredential

azCreds = ClientSecretCredential(transfer_args.az_tenantId, transfer_args.az_clientId, transfer_args.az_clientKey)
blob_service_client = BlobServiceClient(account_url=transfer_args.az_blobUrl, credential=azCreds)
transfer_conn_az = blob_service_client.get_container_client(transfer_args.az_container)
transfer_conn_az.upload_blob(name=absolute_path, data=data, overwrite=True)

Also here is info with multiple different methods to download from Azure for whoever picks this up: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-download-python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants