def __init__(self): self.DEBUG = False self.uuid = '' self.base_uri = '' self.base_host = '' self.redirect_uri = '' self.uin = '' self.sid = '' self.skey = '' self.pass_ticket = '' self.device_id = 'e' + repr(random.random())[2:17] self.base_request = {} self.sync_key_str = '' self.sync_key = [] self.sync_host = '' status = 'wait4login' #表示机器人状态,供WEBAPI读取,WxbotManage使用 bot_conf = {} #机器人配置,在webapi初始化的时候传入,后续也可修改,WxbotManage使用 self.batch_count = 50 #一次拉取50个联系人的信息 self.full_user_name_list = [] #直接获取不到通讯录时,获取的username列表 self.wxid_list = [] #获取到的wxid的列表 self.cursor = 0 #拉取联系人信息的游标 self.is_big_contact = False #通讯录人数过多,无法直接获取 #文件缓存目录 self.temp_pwd = DyCommon.createPath('Stock/Program/WeChat') """ self.temp_pwd = os.path.join(os.getcwd(),'temp') if os.path.exists(self.temp_pwd) == False: os.makedirs(self.temp_pwd) """ self.session = SafeSession() self.session.headers.update({'User-Agent': 'Mozilla/5.0 (X11; Linux i686; U;) Gecko/20070322 Kazehakase/0.4.5'}) self.conf = {'qr': 'png'} self.my_account = {} # 当前账户 # 所有相关账号: 联系人, 公众号, 群组, 特殊账号 self.member_list = [] # 所有群组的成员, {'group_id1': [member1, member2, ...], ...} self.group_members = {} # 所有账户, {'group_member':{'id':{'type':'group_member', 'info':{}}, ...}, 'normal_member':{'id':{}, ...}} self.account_info = {'group_member': {}, 'normal_member': {}} self.contact_list = [] # 联系人列表 self.public_list = [] # 公众账号列表 self.group_list = [] # 群聊列表 self.special_list = [] # 特殊账号列表 self.encry_chat_room_id_list = [] # 存储群聊的EncryChatRoomId,获取群内成员头像时需要用到 self.file_index = 0
def _configStockMongoDb(): path = DyCommon.createPath('Stock/User/Config/Common') file = os.path.join(path, 'DyStockMongoDb.json') # open try: with open(file) as f: data = json.load(f) except: data = DyStockConfig.defaultMongoDb DyStockConfig.configStockMongoDb(data)
def _configStockHistDaysDataSource(): path = DyCommon.createPath('Stock/User/Config/Common') file = os.path.join(path, 'DyStockHistDaysDataSource.json') # open try: with open(file) as f: data = json.load(f) except: data = DyStockConfig.getDefaultHistDaysDataSource() DyStockConfig.configStockHistDaysDataSource(data)
def getStockHistDaysDataSourceFileName(): path = DyCommon.createPath('Stock/User/Config/Common') file = os.path.join(path, 'DyStockHistDaysDataSource.json') return file
def getStockTuShareProDaysIntervalFileName(): path = DyCommon.createPath('Stock/User/Config/Common') file = os.path.join(path, 'DyStockTuShareProDaysInterval.json') return file
def getStockTradeDaysModeFileName(): path = DyCommon.createPath('Stock/User/Config/Common') file = os.path.join(path, 'DyStockTradeDaysMode.json') return file
def getStockAccountFileName(): path = DyCommon.createPath('Stock/User/Config/Trade') file = os.path.join(path, 'DyStockAccount.json') return file
def getStockMongoDbFileName(): path = DyCommon.createPath('Stock/User/Config/Common') file = os.path.join(path, 'DyStockMongoDb.json') return file
def getStockHistDaysTuShareProFileName(): path = DyCommon.createPath('Stock/User/Config/Common') file = os.path.join(path, 'DyStockHistDaysTuSharePro.json') return file