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