basho / riak-python-client

The Riak client for Python.
Apache License 2.0
320 stars 182 forks source link

How create bucket for riak-cs? #549

Open Konstantin74R opened 2 years ago

Konstantin74R commented 2 years ago

I'm use riak-python-client 2.7.0. for riak kv 2.1.1 and riak-cs 2.1.0. I created bucket using protocol pbc, but s3cmd don't see them. Bucket exists in Riak KV and my script show me them. How can i create s3 bucket using riak python client and pbc protocol?

my source code

### Connection options

set_protocol = 'pbc' 
set_host = '10.32.101.72'
set_pb_port = 8087
set_nodes = [{'host':'10.32.101.72', 'pb_port':8087}]

### create connection
myclient = riak.RiakClient(protocol = set_protocol, host = set_host, http_port = set_pb_port, nodes = set_nodes)

### Get list buckets
print(myclient.get_buckets())

### create bucket
mybucket = myclient.bucket('new_bucket')

### Get list key in bucket
print(myclient.get_keys(mybucket))

### insert data to new bucket
obj = riak.RiakObject(myclient, mybucket, 'test_key' )
obj.data = 'asdfasdfasdf'
obj.store()

print(mybucket.get_keys())

fetched1 = mybucket.get('test_key')
print(fetched1.data)'