raiwalletbot.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:RaiWalletBot 作者: SergiySW 项目源码 文件源码
def block_count_callback(bot, update):
    user_id = update.message.from_user.id
    count = rpc({"action": "block_count"}, 'count')
    text_reply(update, "{:,}".format(int(count)))
#   default_keyboard(bot, update.message.chat_id, r)
    # Admin block count check from raiblockscommunity.net
    if (user_id in admin_list):
        http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED',ca_certs=certifi.where())
        response = http.request('GET', summary_url, headers=header, timeout=20.0)
        json_data = json.loads(response.data)
        community_count = json_data['blocks']
        if (math.fabs(int(community_count) - int(count)) > block_count_difference_threshold):
            text_reply(update, 'Community: {0}'.format("{:,}".format(int(community_count))))
            reference_count = int(reference_block_count())
            sleep(1)
            text_reply(update, 'Reference: {0}'.format("{:,}".format(reference_count)))
            response = http.request('GET', 'https://raiwallet.info/api/block_count.php', headers=header, timeout=20.0)
            raiwallet_count = int(response.data)
            sleep(1)
            text_reply(update, 'raiwallet.info: {0}'.format("{:,}".format(raiwallet_count)))


# broadcast
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号