Example #1
0
def _error_message(e, r):
    logger = get_logger()
    logger.error('{} {} {} {} {}'.format("request.url      => ",
                                         str(r.request.method),
                                         str(r.request.url),
                                         str(e.response.status_code),
                                         str(e.response.reason)))
    logger.debug('{} {}'.format("request.headers  =>", str(r.request.headers)))
    logger.debug('{} {}'.format("request.body     =>", str(r.request.body)))
    logger.debug('{} {}'.format("response.headers =>", str(r.headers)))
    logger.error('{} {}'.format("response.body    =>", str(r.text)))
Example #2
0
# coding: utf-8

import json
from collections import defaultdict

from abejacli.config import DATASET_CHUNK_SIZE, ORGANIZATION_ENDPOINT
from abejacli.datalake import generate_channel_file_iter_by_period
from abejacli.logger import get_logger
from abejacli.session import api_post

logger = get_logger()


def create_request_element(channel_id, file_info, property_metadata_keys,
                           category_id, _type):
    """
    create dataset item from datalake file

    :param channel_id:
    :param file_id:
    :param file_info:
    :param property_metadata_keys:
    :param category_id:
    :param _type:
    :return:
    """
    file_id = file_info.get('file_id')
    file_metadata = file_info.get('metadata')
    properties = {}
    for key in property_metadata_keys:
        metadata_name = 'x-abeja-meta-{}'.format(key)