Return server capabilities (RFC 2449) as a dictionary >>> c=poplib.POP3('localhost') >>> c.capa() {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'], 'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [], 'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], '
(self)
| 377 | |
| 378 | |
| 379 | def capa(self): |
| 380 | """Return server capabilities (RFC 2449) as a dictionary |
| 381 | >>> c=poplib.POP3('localhost') |
| 382 | >>> c.capa() |
| 383 | {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'], |
| 384 | 'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [], |
| 385 | 'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [], |
| 386 | 'UIDL': [], 'RESP-CODES': []} |
| 387 | >>> |
| 388 | |
| 389 | Really, according to RFC 2449, the cyrus folks should avoid |
| 390 | having the implementation split into multiple arguments... |
| 391 | """ |
| 392 | def _parsecap(line): |
| 393 | lst = line.decode('ascii').split() |
| 394 | return lst[0], lst[1:] |
| 395 | |
| 396 | caps = {} |
| 397 | try: |
| 398 | resp = self._longcmd('CAPA') |
| 399 | rawcaps = resp[1] |
| 400 | for capline in rawcaps: |
| 401 | capnm, capargs = _parsecap(capline) |
| 402 | caps[capnm] = capargs |
| 403 | except error_proto: |
| 404 | raise error_proto('-ERR CAPA not supported by server') |
| 405 | return caps |
| 406 | |
| 407 | |
| 408 | def stls(self, context=None): |