The first goal is to download the hwp file of comcat site.
dl_name = '1'
dl_path = http://www.comcbt.com/xe/?module=file&act=procFileDownload&file_srl=2651934&sid=57058e18dd8b3d3bcfe0907f7c7ba155&module_srl=555664
req.urlretrieve(response.url, path + '/' + name + '/' + dl_name)
When I download it like this, I get 30KB of HTML. I found the 302 redirection and found the allow_redirects of requests that return the location. So I made it differently
dl_name = '1'
dl_path = http://www.comcbt.com/xe/?module=file&act=procFileDownload&file_srl=2651934&sid=57058e18dd8b3d3bcfe0907f7c7ba155&module_srl=555664
res = requests.get(dl_path, allow_redirects=True)
req.urlretrieve(response.url, path + '/' + name + '/' + dl_name)
If I download it like this, I can get 30KB of HTML. Url at 302 and url at 200 are definitely different from each other when it is 302 for the first time and url is different when it is 200 for sure Do you have any good advice?
python3 urllib
Ask yourself... requests, after allow_redirects Create a new file with open('filename.hwp', 'wb') as f instead of urlretrieve and f.It works well with write(res.content)!
611 GDB gets version error when attempting to debug with the Presense SDK (IDE)
578 Understanding How to Configure Google API Key
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.