Reputation: 4405
This is baffling me. I must be missing something obvious. Just trying to get a ContainerClient
from a BlobServiceClient
.
Example:
import os
import logging
from azure.storage.blob import BlobServiceClient, BlobClient
conn_string = "connection-string-here"
cont_name = "cont-test"
blob_svc_client = BlobServiceClient.from_connection_string(conn_string)
blob_cont_client = BlobServiceClient.get_container_client(cont_name)
Returns:
C:\Users\user\Desktop>python myProgram.py
Traceback (most recent call last):
File "C:\Users\user\Desktop\myProgram.py", line 11, in <module>
blob_cont_client = BlobServiceClient.get_container_client(cont_name)
TypeError: get_container_client() missing 1 required positional argument: 'container'
get_container_client()
is not missing the positionaly argument 'container'.Why is this happening?
Upvotes: 0
Views: 5683
Reputation: 1301
I have modified your code by adding the extension to blob_svc_client with get_container_client variable. Below is the updated code:
import os
import logging
from azure.storage.blob import BlobServiceClient, BlobClient
conn_string = "connection-string-here"
cont_name = "cont-test"
blob_svc_client = BlobServiceClient.from_connection_string(conn_string)
blob_cont_client = blob_svc_client.get_container_client(cont_name)
I have reproduced your error as below:
Below is the fixed screenshot:
Upvotes: 2