예제 #1
0
    def make_user_offline(self, username):
        if len(self.admin_token) == 0 or len(self.username) == 0:
            return -1

        url = self.rest_base_url + '/users/' + username + '/disconnect'
        headers = {'Authorization': self.admin_rest_token}
        headers.update(BASE_HEADERS)
        response = dxrequest.delete(url, BASE_HEADERS, None)

        return response.code
예제 #2
0
    def remove_user_from_group_block(self, group_id, username):
        if len(self.token) == 0:
            print('请先进行获取token操作')
            return -1
        if len(group_id) == 0 or len(username) == 0:
            print('参数为空')
            return -1

        url = self.rest_base_url + '/chatgroups/' + group_id + '/blocks/users/' + username
        headers = {'Authorization': self.rest_token}
        headers.update(BASE_HEADERS)
        response = dxrequest.delete(url, headers, None)
        return response.code
예제 #3
0
    def delete_group_member(self, group_id, username):
        if len(self.token) == 0:
            print('请先进行获取token操作')
            return None
        if len(group_id) == 0 or len(username) == 0:
            print('参数为空')
            return None

        url = self.rest_base_url + '/chatgroups/' + group_id + '/users/' + username
        headers = {'Authorization': self.rest_token}
        headers.update(BASE_HEADERS)
        response = dxrequest.delete(url, headers, None)
        return response.data['data']
예제 #4
0
    def exit_group(self, group_id):
        if len(self.token) == 0:
            print('请先进行获取token操作')
            return None

        if len(group_id) == 0:
            print('群组ID为空')
            return None

        url = self.rest_base_url + '/chatgroups/' + group_id
        headers = {'Authorization': self.rest_token}
        headers.update(BASE_HEADERS)
        response = dxrequest.delete(url, headers, None)
        return response.code
예제 #5
0
    def remove_user_from_black(self, username):
        if len(self.token) == 0:
            print('请先进行获取token操作')
            return 0

        if len(username) == 0:
            print('用户名为空')
            return 0

        url = self.rest_base_url + '/users/' + self.username + '/blocks/users/' + username
        headers = {'Authorization': self.rest_token}
        headers.update(BASE_HEADERS)
        response = dxrequest.delete(url, headers, None)
        return response.code