import boto from boto.dynamodb2.layer1 import DynamoDBConnection from boto.dynamodb2.table import Table from feed_status import config FEED_INGESTION_TABLE = Table(config.FEED_INGESTION_TABLE) def get_overall_status(feed_name, date): """Get status of the ingestion job Args: feed_name (str): Feed name date (str): Reporting date of the ingestion job Returns: mixed (False | status code): False if item not found. Status code if item is found. """ item = _get_item(feed_name, date) if item: return item['status'] return False def get_ingestion_history(feed_name, from_date, to_date): try: item = FEED_INGESTION_TABLE.query_2( feed_name__eq=feed_name, date__between=[from_date, to_date]) return item except boto.dynamodb2.exceptions.ItemNotFound: return False