How to use the imapclient.exceptions.CapabilityError function in IMAPClient

To help you get started, we’ve selected a few IMAPClient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mjs / imapclient / tests / test_sort.py View on Github external
def test_no_support(self):
        self.client._cached_capabilities = (b'BLAH',)
        self.assertRaises(CapabilityError, self.client.sort, 'ARRIVAL')
github mjs / imapclient / tests / test_imapclient.py View on Github external
def test_no_support(self):
        self.client._cached_capabilities = (b'IMAP4rev1',)
        self.assertRaises(CapabilityError, self.client.id_)
github mjs / imapclient / tests / test_thread.py View on Github external
def test_unsupported_algorithm(self):
        self.client._cached_capabilities = (b'THREAD=FOO',)
        self.assertRaises(CapabilityError, self.client.thread)
github mjs / imapclient / tests / test_thread.py View on Github external
def test_no_thread_support(self):
        self.client._cached_capabilities = (b'NOT-THREAD',)
        self.assertRaises(CapabilityError, self.client.thread)
github mjs / imapclient / imapclient / imapclient.py View on Github external
def wrapper(client, *args, **kwargs):
            if not client.has_capability(capability):
                raise exceptions.CapabilityError(
                    'Server does not support {} capability'.format(capability)
                )
            return func(client, *args, **kwargs)
github mjs / imapclient / imapclient / imapclient.py View on Github external
Each returned thread is a list of messages ids. An example
        return value containing three message threads::

            ((1, 2), (3,), (4, 5, 6))

        The optional *algorithm* argument specifies the threading
        algorithm to use.

        The *criteria* and *charset* arguments are as per
        :py:meth:`.search`.

        See :rfc:`5256` for more details.
        """
        algorithm = to_bytes(algorithm)
        if not self.has_capability(b'THREAD=' + algorithm):
            raise exceptions.CapabilityError(
                'The server does not support %s threading algorithm' % algorithm
            )

        args = [algorithm, to_bytes(charset)] + \
            _normalise_search_criteria(criteria, charset)
        data = self._raw_command_untagged(b'THREAD', args)
        return parse_response(data)