def dfuuid3nohead(inputdf: pd.DataFrame): # ['UserName', 'NickName', 'ContactFlag', 'RemarkName', 'Sex', 'Signature', 'StarFriend', 'AttrStatus', 'Province', 'City', 'SnsFlag', 'KeyWord', 'imguuid', 'headimg'] frddf2append = inputdf.copy(deep=True) # [NickName', 'ContactFlag', 'RemarkName', 'Sex', 'Signature', 'StarFriend', 'AttrStatus', 'Province', 'City', 'SnsFlag', 'KeyWord'] clnamescleanlst = [ cl for cl in list(frddf2append.columns.values) if cl.lower() not in ['username', 'headimg'] ] # print(clnamescleanlst) frddf2appendnoimguuid = frddf2append.loc[:, clnamescleanlst] frddf2appendnoimguuid['contactuuid'] = frddf2appendnoimguuid[ clnamescleanlst].apply(lambda x: uuid3hexstr(list(x.values)), axis=1) # ['UserName', 'NickName', 'ContactFlag', 'RemarkName', 'Sex', 'Signature', 'StarFriend', 'AttrStatus', 'Province', 'City', 'SnsFlag', 'KeyWord', 'headimg', 'appendtime'] frddf2appendnoimguuid['appendtime'] = pd.Timestamp.now() return frddf2appendnoimguuid
def get_host_uuid(): hotdir = itchat.originInstance.hotReloadDir # print(hotdir) # itchat.pkl return uuid3hexstr(os.path.abspath(hotdir))
def testuuidlen(inputdf: pd.DataFrame): frddf2append = inputdf.copy(deep=True) # frddf2append = frddf frddf2append['contactuuid'] = frddf2append.apply( lambda x: uuid3hexstr(list(x.values)), axis=1) print(frddf2append[['NickName', 'contactuuid']])
outdfmulti = outdfraw.loc[outdfraw['remarkname'].isin(list( hcds.index))].copy(deep=True) outdfmulti # - # ### 处理联系人信息入库 # ### 热启动微信服务 pklabpath = os.path.relpath(touchfilepath2depth(getdirmain() / 'itchat.pkl')) print(pklabpath) itchat.auto_login(hotReload=True, statusStorageDir=pklabpath) #热启动你的微信 # #### 生成uuid区分不同的登录(按照pkl的存放地儿) uuid3hexstr(os.path.abspath(itchat.originInstance.hotReloadDir)) # #### 获取联系人列表 # 随机显示几个 frdlst = itchat.get_friends() len(frdlst) [fd for fd in frdlst if fd['NickName'] == 'heart5'] ranslice = random.sample(range(len(frdlst)), 3) ranslice for i in ranslice: print(frdlst[i], '\n') itchat.search_friends(userName="******") itchat.search_friends(wechatAccount="heart57479")
'\t'.join([qun['NickName'] for qun in ctlst if qun['IsOwner'] == 0]) # %% [markdown] # ##### `itchat.originInstance.HotReloadDir` # %% [markdown] # 热启动的pkg文件地址。 # %% itchat.originInstance.hotReloadDir # %% os.path.abspath(itchat.originInstance.hotReloadDir) # %% uuid3hexstr(os.path.abspath(itchat.originInstance.hotReloadDir)) # %% [markdown] # 参照,看是不是每次会不一样 # %% uuid3hexstr(os.path.abspath(itchat.originInstance.hotReloadDir)) # %% [markdown] # ##### `itchat.originInstance.receivingRetryCount` # %% [markdown] # 接收信息时重试的次数(默认值是5),还可以赋值设定 # %% itchat.originInstance.receivingRetryCount