์๋ฌ : Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing data: incorrect data check')
res = requests.get( page_url, headers={ 'User-Agent': utils.get_random_agent() }, timeout=10 )
content = res.content
์์ ๊ฐ์ด ์์ฒญ์, ์๋์ ๊ฐ์ ๋ฉ์ธ์ง์ ํจ๊ป ํฌ๋กค๋ง์ด ์งํ์ด ๋ถ๊ฐํ ์ํฉ์ด ๋ฐ์ํ๋ค.
# error
Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing data: incorrect data check')
์ต์ ์ ์ถ๊ฐํ๋ค.
res = requests.get( page_url, headers={ 'User-Agent': utils.get_random_agent(), 'Accept-Encoding': 'identity' }, timeout=10, stream=True )
content = res.raw.read()
* ์ถ๊ฐ๋ ๊ฒ์
1. 'Accept-Encoding': 'identity'
2. stream=True
* ์์ ๋ ๊ฒ์
content = res.content ์ผ๋ก ๊ฐ์ง๊ณ ์ค๋ ๊ฒ ๋์ content = res.raw.read() ์ผ๋ก ์ฝ์ด์ฃผ๋ ์ ์งํ๋๋ ๊ฒ์ ํ์ธํ๋ค.
๊ทผ๋ฐ ์ข ๋๋ ค์ง
'๐ฉ๐ปโ๐ป > python' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[python] Fastapi ์ ํ๋ฆฌ์ผ์ด์ exe ํ์ผ๋ก ๋ฐฐํฌํ๊ธฐ (0) | 2024.11.05 |
---|---|
[python] socket ๋์ ์ฐ๊ฒฐ (1) | 2024.10.22 |
[python] fastapi ์ค์๊ฐ ์คํธ๋ฆฌ๋ฐ ์ด๋ฏธ์ง ์ก์ถ (0) | 2024.10.21 |
[python] TypeError: 'type' object is not subscriptable (1) | 2024.05.02 |
[python] ๋ค์ด๋ฒ ์นดํ ํฌ๋กค๋ง (1) | 2024.01.30 |