def put(self, id): verify_content = request.args.get('verifyContent', '') user = next((u for u in sum([g.members for g in current_bot.groups()], []) if u.puid == id), None) if user is None: raise ApiException(errors.not_found) current_bot.add_friend(user, verify_content) return {}
def put(self, id): verify_content = request.args.get('verifyContent', '') user = next((u for u in sum( [g.members for g in current_bot.groups()], []) if u.puid == id), None) if user is None: raise ApiException(errors.not_found) current_bot.add_friend(user, verify_content) return {}
def put(self): verify_content = request.args.get('verifyContent', '') ids = set(request.args.getlist('wxid[]')) users = [u for u in sum([g.members for g in current_bot.groups()], []) if u.puid in ids] if users is None: raise ApiException(errors.not_found) for user in users: current_bot.add_friend(user, verify_content) unexpected = ids.difference(set([u.id for u in users])) if unexpected: raise ApiException( errors.not_found, '如下puid用户未找到: {}'.format(','.join(unexpected))) return {}
def put(self): verify_content = request.args.get('verifyContent', '') ids = set(request.args.getlist('wxid[]')) users = [u for u in sum([g.members for g in current_bot.groups()], []) if u.puid in ids] if users is None: raise ApiException(errors.not_found) for user in users: current_bot.add_friend(user, verify_content) unexpected = ids.difference(set([u.id for u in users])) if unexpected: raise ApiException( errors.not_found, '如下puid用户未找到: {}'.format(','.join(unexpected))) return {}