S3 - Bug fix? Not sure

This commit is contained in:
Steve L. Nyemba 2017-09-26 15:54:26 -05:00
parent 3e77175d06
commit cf6f017b91
1 changed files with 6 additions and 4 deletions

8
transport.py Normal file → Executable file
View File

@ -646,7 +646,7 @@ class s3 :
""" """
try: try:
self.s3 = boto.connect_s3(args['access_key'],args['secret_key']) self.s3 = boto.connect_s3(args['access_key'],args['secret_key'])
self.bucket = self.s3.get_bucket(args['bucket']) if 'bucket' in args else None self.bucket = self.s3.get_bucket(args['bucket'].strip(),validate=False) if 'bucket' in args else None
# self.path = args['path'] # self.path = args['path']
self.filter = args['filter'] if 'filter' in args else None self.filter = args['filter'] if 'filter' in args else None
self.filename = args['file'] if 'file' in args else None self.filename = args['file'] if 'file' in args else None
@ -747,9 +747,11 @@ class DataSource:
return self.Input.read(size) return self.Input.read(size)
def write(self,**args): def write(self,**args):
self.Output.write(**args) self.Output.write(**args)
# conf = json.loads(open('conf.json').read()) conf = json.loads(open('config.json').read())
#x = s3Reader( dict(conf,**{'bucket':'com.phi.sample.data','file':'Sample-Spreadsheet-5000-rows.csv'})) #x = s3Reader( dict(conf,**{'bucket':'com.phi.sample.data','file':'Sample-Spreadsheet-5000-rows.csv'}))
x = s3Reader(conf)
print conf
print x.bucket.get_all_keys()
# r = x.read() # r = x.read()
# for item in r : # for item in r :
# print item # print item