Example #1
0
 def test_set_contents(self):
   conn = aws.s3conn()
   bucket = conn.get_bucket(self.bucket_name)
   filepath = os.path.join(os.path.dirname('__file__'),'up_testfile')
   file = open(filepath)
   actual = aws.set_contents(bucket,file)
   print(actual)
   assert actual != 0
Example #2
0
def main(param):
  try:
    # s3 url access
    s3conn = aws.s3conn()
    s3bucket = aws.get_bucket(s3conn, config.get('s3', 'p_refined_data_bucket'))
    rdsconn = aws.rdsconn(config)
    getsql = "select maker_id, data_type, data_date, status, msg from data_ctrl_mst where maker_id = %s and data_type = '%s' and data_date = '%s' and status = 'refine' and msg is not null; " % (param.maker_id, param.data_type, param.data_date)
    res = aws.fetch_sql(rdsconn, getsql)
    if len(res) == 1:
      process_data(s3bucket, rdsconn, res[0])
    else:
      raise ValueError('抽出ファイルエラー sq:{0}'.format(getsql))
  except Exception as e:
    log.except_log(logger, e)
Example #3
0
 def test_get_contents_e(self):
   conn = aws.s3conn()
   bucket = conn.get_bucket(self.bucket_name)
   filepath = os.path.join(os.path.dirname('__file__'))
   aws.get_contents(bucket,'somemissingfile',filepath)
Example #4
0
 def test_get_contents(self):
   conn = aws.s3conn()
   bucket = conn.get_bucket(self.bucket_name)
   filepath = os.path.join(os.path.dirname('__file__'))
   actual = aws.get_contents(bucket,'dl_testfile',filepath)
   assert actual is True
Example #5
0
 def test_get_bucket(self):
   conn = aws.s3conn()
   actual = aws.get_bucket(conn,self.bucket_name)
   assert actual.name == self.bucket_name
Example #6
0
 def test_s3conn(self):
   actual = aws.s3conn()
   assert actual.host == 's3.amazonaws.com'