Error when opening zipfiles requests. zipfile.BadZipFile: File is not a zip file #2213
-
|
After attempting to donwload and extract a zipfile using httpx it throws the following error However, using the exact same code but with the requests module works as intended |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
Could you provide an example that we're able to reproduce? Specifically, including the URL you're using would help here. |
Beta Was this translation helpful? Give feedback.
-
|
Solved, I didn't notice that httpx didn't follow redirects by default, that was why it was working with the request module but not with httpx. (follow_redirects=True) |
Beta Was this translation helpful? Give feedback.
-
|
GZIP, renaming, tracing, and 7zip expressions are the most basic ways to overcome the problem (Zipfile.badzipfile: file is not a zip) in Python. In fact, these two options necessitate the installation of new modules. Read this |
Beta Was this translation helpful? Give feedback.
Solved, I didn't notice that httpx didn't follow redirects by default, that was why it was working with the request module but not with httpx. (follow_redirects=True)