Пример #1
0

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())):
def test_owner_screen_name():
    ch = load_credentials()
    cid, cinfo = ch.get_credentials()
    api = TTR_API(cinfo)
    for s_elem in api.search_past("#555 OR 666 OR @777"):
        print s_elem.get('owner').get('screen_name')