def add_member_into_chatroom(self, chatroomUserName, memberList, useInvitation=False):
 if (not useInvitation):
  chatroom = self.storageClass.search_chatrooms(userName=chatroomUserName)
  if (not chatroom):
   chatroom = self.update_chatroom(chatroomUserName)
  if (len(chatroom['MemberList']) > self.loginInfo['InviteStartCount']):
   useInvitation = True
 if useInvitation:
  (fun, memberKeyName) = ('invitemember', 'InviteMemberList')
 else:
  (fun, memberKeyName) = ('addmember', 'AddMemberList')
 url = ('%s/webwxupdatechatroom?fun=%s&pass_ticket=%s' % (self.loginInfo['url'], fun, self.loginInfo['pass_ticket']))
 params = {'BaseRequest': self.loginInfo['BaseRequest'], 'ChatRoomName': chatroomUserName, memberKeyName: ','.join([member['UserName'] for member in memberList])}
 headers = {'content-type': 'application/json; charset=UTF-8', 'User-Agent': config.USER_AGENT}
 r = self.s.post(url, data=json.dumps(params), headers=headers)
 return ReturnValue(rawResponse=r)

def add_member_into_chatroom ( self , chatroomUserName , memberList , useInvitation = False ) : if ( not useInvitation ) : chatroom = self . storageClass . search_chatrooms ( userName = chatroomUserName ) if ( not chatroom ) : chatroom = self . update_chatroom ( chatroomUserName ) if ( len ( chatroom [ 'MemberList' ] ) > self . loginInfo [ 'InviteStartCount' ] ) : useInvitation = True if useInvitation : ( fun , memberKeyName ) = ( 'invitemember' , 'InviteMemberList' ) else : ( fun , memberKeyName ) = ( 'addmember' , 'AddMemberList' ) url = ( '%s/webwxupdatechatroom?fun=%s&pass_ticket=%s' % ( self . loginInfo [ 'url' ] , fun , self . loginInfo [ 'pass_ticket' ] ) ) params = { 'BaseRequest' : self . loginInfo [ 'BaseRequest' ] , 'ChatRoomName' : chatroomUserName , memberKeyName : ',' . join ( [ member [ 'UserName' ] for member in memberList ] ) } headers = { 'content-type' : 'application/json; charset=UTF-8' , 'User-Agent' : config . USER_AGENT } r = self . s . post ( url , data = json . dumps ( params ) , headers = headers ) return ReturnValue ( rawResponse = r )
add or invite member into chatroom * there are two ways to get members into chatroom: invite or directly add * but for chatrooms with more than 40 users .