def write_index(bucket, feed_data): try: index = s3.get_object( Bucket=bucket, Key='feeds.json',) feed_index = json.load(index['Body']) except ClientError as e: error_code = e.response['Error']['Code'] if error_code == 'NoSuchKey': feed_index = {} else: raise e feed_path = feed_data['encoded_path'] feed_index[feed_path] = feed_data s3.put_object( Bucket=bucket, Key='feeds.json', Body=json.dumps(feed_index, indent=4), ContentType='application/json' ) index_template = """
{} """ feed_links = [ '