File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -127,10 +127,18 @@ def __iter(self) -> Iterator[ResponseT]:
127127 process_line = self ._client ._process_stream_line
128128 process_data = self ._client ._process_response_data
129129
130+ awaiting_ping_data = False
130131 for raw_line in response .iter_lines ():
131132 if not raw_line or raw_line == "\n " :
132133 continue
133134
135+ if raw_line .startswith ("event: ping" ):
136+ awaiting_ping_data = True
137+ continue
138+ if awaiting_ping_data :
139+ awaiting_ping_data = False
140+ continue
141+
134142 try :
135143 line = process_line (raw_line )
136144 except StopStreaming :
@@ -168,10 +176,18 @@ async def __iter(self) -> AsyncIterator[ResponseT]:
168176 process_line = self ._client ._process_stream_line
169177 process_data = self ._client ._process_response_data
170178
179+ awaiting_ping_data = False
171180 async for raw_line in response .aiter_lines ():
172181 if not raw_line or raw_line == "\n " :
173182 continue
174183
184+ if raw_line .startswith ("event: ping" ):
185+ awaiting_ping_data = True
186+ continue
187+ if awaiting_ping_data :
188+ awaiting_ping_data = False
189+ continue
190+
175191 try :
176192 line = process_line (raw_line )
177193 except StopStreaming :
You can’t perform that action at this time.
0 commit comments