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