Yield a burst of responses no more than 'interval' seconds apart. with M.idle() as idler: # get a response and any others following by < 0.1 seconds batch = list(idler.burst()) print(f'processing {len(batch)} responses...') print(batch)
(self, interval=0.1)
| 1591 | return typ, data |
| 1592 | |
| 1593 | def burst(self, interval=0.1): |
| 1594 | """Yield a burst of responses no more than 'interval' seconds apart. |
| 1595 | |
| 1596 | with M.idle() as idler: |
| 1597 | # get a response and any others following by < 0.1 seconds |
| 1598 | batch = list(idler.burst()) |
| 1599 | print(f'processing {len(batch)} responses...') |
| 1600 | print(batch) |
| 1601 | |
| 1602 | Note: This generator requires a socket connection (not IMAP4_stream). |
| 1603 | """ |
| 1604 | if not self._imap.sock: |
| 1605 | raise self._imap.error('burst() requires a socket connection') |
| 1606 | |
| 1607 | try: |
| 1608 | yield next(self) |
| 1609 | except StopIteration: |
| 1610 | return |
| 1611 | |
| 1612 | while response := self._pop(interval, None): |
| 1613 | yield response |
| 1614 | |
| 1615 | |
| 1616 | if HAVE_SSL: |