frostfs-sdk-python/frostfs_api/client/frostfs_client.py

23 lines
651 B
Python

# Create channel and Stubs
import grpc
from frostfs_api.client.services.container import ContainerClient
class FrostfsClient:
def __init__(self, address):
self.channel = grpc.insecure_channel(address)
self.container = ContainerClient(self.channel)
def close(self):
self.channel.close()
if __name__ == "__main__":
client = FrostfsClient("localhost:50051")
create_response = client.container.create_container("my_container")
print("Container created:", create_response)
get_response = client.container.get_container(create_response)
print("Container details:", get_response)
client.close()