def test_uri(self):
   client = GalaxyFDSClient(access_key, access_secret,
                            FDSClientConfiguration(region_name, False, False, False))
   bucket_name = self.bucket_name + "1"
   if (client.does_bucket_exist(bucket_name)):
     client.delete_bucket(bucket_name)
   client.create_bucket(bucket_name)
   client.delete_bucket(bucket_name)
 def test_uri(self):
   client = GalaxyFDSClient(access_key, access_secret,
       FDSClientConfiguration(region_name, False, False, False))
   bucket_name = self.bucket_name + "1"
   if (client.does_bucket_exist(bucket_name)):
     client.delete_bucket(bucket_name)
   client.create_bucket(bucket_name)
   client.delete_bucket(bucket_name)
Esempio n. 3
0
config = FDSClientConfiguration()
bucket_name = 'fds-python-example-%d' % int(time.time())

fds_client = GalaxyFDSClient(access_key, access_secret, config)

#####################
# List buckets
buckets = fds_client.list_buckets()
print('buckets list:')
for bucket in buckets:
    print(bucket)
print("---end---")

# Check and create the bucket
if not fds_client.does_bucket_exist(bucket_name):
    fds_client.create_bucket(bucket_name)
#####################

#####################
# Put a string object
object_name = 'test1.txt'
object_content = 'Hello world! This is a simple test!'
fds_client.put_object(bucket_name, object_name, object_content)

# Get the object content
obj = fds_client.get_object(bucket_name, object_name)
for chunk in obj.stream:
    sys.stdout.write(chunk)
print('\n')

# Download the object file
config = FDSClientConfiguration()
bucket_name = 'fds-python-example-%d' % int(time.time())

fds_client = GalaxyFDSClient(access_key, access_secret, config)

#####################
# List buckets
buckets = fds_client.list_buckets()
print 'buckets list:'
for bucket in buckets:
  print bucket
print

# Check and create the bucket
if not fds_client.does_bucket_exist(bucket_name):
  fds_client.create_bucket(bucket_name)
#####################

#####################
# Put a string object
object_name = 'test1.txt'
object_content = 'Hello world! This is a simple test!'
fds_client.put_object(bucket_name, object_name, object_content)

# Get the object content
obj = fds_client.get_object(bucket_name, object_name)
for chunk in obj.stream:
  sys.stdout.write(chunk)
print '\n'

# Download the object file