in firebase_admin/_sseclient.py [0:0]
def __next__(self):
if not re.search(end_of_field, self.buf):
temp_buffer = _EventBuffer()
while not temp_buffer.is_end_of_field:
try:
nextchar = next(self.resp_iterator)
temp_buffer.append(nextchar)
except (StopIteration, requests.RequestException):
time.sleep(self.retry / 1000.0)
self._connect()
# The SSE spec only supports resuming from a whole message, so
# if we have half a message we should throw it out.
temp_buffer.truncate()
continue
self.buf = temp_buffer.buffer_string
split = re.split(end_of_field, self.buf)
head = split[0]
self.buf = '\n\n'.join(split[1:])
event = Event.parse(head)
if event.data == 'credential is no longer valid':
self._connect()
return None
if event.data == 'null':
return None
# If the server requests a specific retry delay, we need to honor it.
if event.retry:
self.retry = event.retry
# last_id should only be set if included in the message. It's not
# forgotten if a message omits it.
if event.event_id:
self.last_id = event.event_id
return event