コード例 #1
0
ファイル: send.py プロジェクト: xutaoding/announcement_hkz
    strategy.setSType(Storage.S3CN);
    ListKeysAction action = new ListKeysAction();
    action.setKey("/announce/cn/20110131/");
    action.setStrategy(strategy);
    Object list = passageClient.perform(action);
    System.out.println("list = " + list);
"""
# host = '192.168.250.206' # 206 server
host = '54.223.53.153'
port = 8888

socket = TSocket.TSocket(host, port)
# socket = TSSLSocket.TSSLSocket(host, port, validate=False)
transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = Client(protocol)
transport.open()

s3_strategy = Strategy(Storage.S3CN, 'cn.com.chinascope.dfs')

#  # send
# with open('D:/temp/data/aaa.txt', 'rb') as fp:
#     data = fp.read()
#
# client.putObject(s3_strategy, SObject(key='/announce/hkz/20161215/1200.pdf', data=data))

# list
ll = client.listKeys(s3_strategy, '/announce/hkz/20160217/')
print '\n'.join(ll)
print 'count:', len(ll)
コード例 #2
0
ファイル: test.py プロジェクト: xutaoding/announcement_hkz
    strategy.setBucketName("cn.com.chinascope.dfs");
    strategy.setSType(Storage.S3CN);
    ListKeysAction action = new ListKeysAction();
    action.setKey("/announce/cn/20110131/");
    action.setStrategy(strategy);
    Object list = passageClient.perform(action);
    System.out.println("list = " + list);
"""
host = '192.168.250.206'
port = 8888

socket = TSocket.TSocket(host, port)
# socket = TSSLSocket.TSSLSocket(host, port, validate=False)
transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = Client(protocol)
transport.open()

strategy = Strategy(Storage.HAFS, "/mfs/d01/")
sobject = SObject('announce/hkcn/2015/12/14/11ccce6a3c40242f8437061314b9bff4_SAU1542fmo.pdf')


ff = client.getObject(strategy, 'announce/hkcn/2015/12/14/11ccce6a3c40242f8437061314b9bff4_SAU1542fmo.pdf')
print ff.data

transport.close()