File tree 6 files changed +331
-182
lines changed 6 files changed +331
-182
lines changed Original file line number Diff line number Diff line change 1
1
import asyncio
2
2
from extra .client import HTTPClient
3
3
from extra .http .model import HTTPBodyBlob
4
-
5
- import zlib
6
-
7
-
8
- class GzipDecoder :
9
- def __init__ (self ):
10
- self .decompressor = zlib .decompressobj (wbits = zlib .MAX_WBITS | 32 )
11
- self .buffer = io .BytesIO ()
12
-
13
- def feed (self , chunk : bytes ) -> bytes | None :
14
- return self .decompressor .decompress (chunk )
15
-
16
- def flush (self ) -> bytes | None :
17
- return self .decompressor .flush ()
4
+ from extra .utils .codec import GZipDecoder
18
5
19
6
20
7
# NOTE: Start "examples/sse.py"
21
8
async def main (path : str , host : str = "127.0.0.1" , port : int = 443 , ssl : bool = True ):
22
- transform = GzipDecoder ()
9
+ transform = GZipDecoder ()
23
10
24
11
with open ("/dev/stdout" , "wb" ) as f :
25
12
async for atom in HTTPClient .Request (
Original file line number Diff line number Diff line change 16
16
HTTPBodyFile ,
17
17
HTTPHeaders ,
18
18
HTTPBody ,
19
- HTTPReaderBody ,
19
+ HTTPBodyIO ,
20
20
HTTPAtom ,
21
21
HTTPProcessingStatus ,
22
22
)
@@ -479,7 +479,7 @@ async def Request(
479
479
* ,
480
480
port : int | None = None ,
481
481
headers : dict [str , str ] | None = None ,
482
- body : HTTPReaderBody | HTTPBodyBlob | None = None ,
482
+ body : HTTPBodyIO | HTTPBodyBlob | None = None ,
483
483
params : dict [str , str ] | str | None = None ,
484
484
ssl : bool = True ,
485
485
verified : bool = True ,
@@ -591,7 +591,7 @@ async def request(
591
591
* ,
592
592
port : int | None = None ,
593
593
headers : dict [str , str ] | None = None ,
594
- body : HTTPReaderBody | HTTPBodyBlob | None = None ,
594
+ body : HTTPBodyIO | HTTPBodyBlob | None = None ,
595
595
params : dict [str , str ] | str | None = None ,
596
596
ssl : bool = True ,
597
597
verified : bool = True ,
You can’t perform that action at this time.
0 commit comments