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