Esempio n. 1
0
    def get_history_message(self, time):
        if len(time) == 0:
            print('请填写时间')

        url = self.rest_base_url + '/chatmessages/' + time
        headers = {'Authorization': self.admin_rest_token}
        headers.update(BASE_HEADERS)

        response = dxrequest.get(url, headers)
        return response
Esempio n. 2
0
    def get_current_user_groups(self):
        if len(self.token) == 0:
            print('请先进行获取token操作')
            return 0

        url = self.rest_base_url + '/users/' + self.username + '/joined_chatgroups'
        headers = {'Authorization': self.rest_token}
        headers.update(BASE_HEADERS)
        response = dxrequest.get(url, headers, None)
        groups = response.data['data']
        return groups
Esempio n. 3
0
    def get_group_blacks(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 + '/blocks/users'
        headers = {'Authorization': self.rest_token}
        headers.update(BASE_HEADERS)
        response = dxrequest.get(url, headers, None)
        return response.data['data']
Esempio n. 4
0
    def get_contacts(self):
        if len(self.token) == 0:
            print('请先进行获取token操作')
            return None

        url = self.rest_base_url + '/users/' + self.username + '/contacts/users'
        headers = {'Authorization': self.rest_token}
        headers.update(BASE_HEADERS)
        response = dxrequest.get(url, headers, None)
        if response.code == 0:
            contacts = response.data['data']
            return contacts

        return None