def process_callback(context, message):
    result = process_message_hash(context, message)
    result = process_message_unshort_urls(context, result)
    result = process_implying_entities(None, result)
    source_post = message.get("re_post_info")
    if source_post:
        result["re_post_info"] = process_callback(context, source_post)
    return result
def to_timestamp(dt):
    return (dt - datetime.datetime(1970, 1, 1)).total_seconds()


if __name__ == '__main__':
    cred = load_credentials()
    cred_data = cred.get_credentials()
    if not cred_data:
        print "not credentials data"
        sys.exit(-1)

    _, cred_info = cred_data

    api = TTR_API(cred_info)
    context = DbHandler()

    properties.url_statistic_time = 10

    for message in api.search_past("#битваэкстрасенсов", 10):

        result = processing.process_message_hash(context, message)
        result = processing.process_message_unshort_urls(context, result)
        result = processing.process_implying_entities(None, result)


    for stat in context.get_statistic(
            to_timestamp(datetime.datetime.now() - timedelta(days=1)),
            to_timestamp(datetime.datetime.now())):

        print stat