import time

import pandas as pd

# def writeaa():
#     detailList=[]
#     aa={
#         'id':3,
#         'name':'qqqwe'
#     }
#     detailList.append(aa)
#     writerToExcel(detailList)
# 将数据追加到excel
# def writerToExcel(detailList):
#     # filename='baidu搜索.xlsx'
#     # 读取已存在的xlsx文件
#     existing_data = pd.read_excel(filename,engine='openpyxl')
#     # 创建新的数据
#     new_data = pd.DataFrame(data=detailList)
#     # 将新数据添加到现有数据的末尾
#     combined_data = existing_data.append(new_data, ignore_index=True)
#     # 将结果写入到xlsx文件
#     combined_data.to_excel(filename, index=False)
#
# from openpyxl import Workbook
#
# if __name__ == '__main__':
#     filename='test1.xlsx'
#     # # 创建一个工作簿
#     workbook = Workbook(filename)
#     workbook.save(filename)
#     writeaa()

# gpdm = '01109.HK'
# if 'HK' in str(gpdm):
#     tmp_g = str(gpdm).split('.')[0]
#     if len(tmp_g) == 5:
#         gpdm = str(gpdm)[1:]
#         print(gpdm)
#     else:
#         pass
import redis

from base.BaseCore import BaseCore
baseCore = BaseCore()
r = baseCore.r
key = 'counter'
expiration_time = 10  # 设置过期时间 60秒
# # 设置自增
# r.incr(key)


# # #自增并设置过期时间
# while True:
#     # 设置自增
#     r.incr(key)
#     value = int(r.get(key).decode())
#
#     if value > 10:
#         print(value)
#         # 设置过期时间
#         r.expire(key, expiration_time)
#         time.sleep(20)
#         print('------------------')
#         continue
#     # print(value)
#     time.sleep(5)
#     print(value)
#     print("==========")

def check_url():
    r = redis.Redis(host="114.115.236.206", port=6379, password='clbzzsn',db=6)
    res = r.exists('WeiXinGZH:infoSourceCode','IN-20220418-0001')
    print(res)
    if res == 1:
        print('True')
    else:
        print('False')
check_url()



