from time import sleep from apiclient import ApiClient from utils.db_helper import execute_sql from utils.log_util import setup_logging from utils.common_util import get_common_exchange_name # EXCHANGE_NAME_MAPPING = { # 'huobi': 'huobi.pro', # 'bancor': 'bancor.network', # 'yobit.net': 'yobit', # 'zb.com': 'zb', # 'coinexchange.io': 'coinexchange', # "bigone": 'big.one' # } setup_logging() logger = logging.getLogger() class EthBalanceCollector(ApiClient): def __init__(self, host, user, password): super(EthBalanceCollector, self).__init__(host, user, password) self.info_date = self.now self.uri = f"/v1/markets/balance?net=eth&day={self.info_date.strftime('%Y%m%d')}" def get_exchange_eth_info(self): headers = self.get_headers() url = self.host + self.uri logger.info(f"get eth info url: {url}") res = requests.get(url, headers=headers, timeout=10) retry = 10
print 'tag=%s' % RocketMQConsumeClient.ConsumeClient.get_message_tags( message) print 'body=%s' % RocketMQConsumeClient.ConsumeClient.get_message_body( message) print 'msg id=%s' % RocketMQConsumeClient.ConsumeClient.get_message_id( message) print 'map.keys %s' % RocketMQConsumeClient.ConsumeClient.get_message_keys( message) print 'map.name %s' % RocketMQConsumeClient.ConsumeClient.get_message_property( message, 'name') print 'map.id %s' % RocketMQConsumeClient.ConsumeClient.get_message_property( message, 'id') return 0 logger = log_util.setup_logging(default_path="logs/logging.json") consumeClient = RocketMQConsumeClient.ConsumeClient(name_srv, group_id, topic_tag_list) consumeClient.startup_consumer(consumer_message, thread_count, max_batch_size, None) i = 1 while i <= 600: logger.info(i) i += 1 time.sleep(10) consumeClient.ShutdownPushConsumer(consumeClient.consumer) consumeClient.DestroyPushConsumer(consumeClient.consumer) logger.info("Consumer Down....")