Download the file while viewing the progress in Python 3.x

I was disappointed with the code highlights in Qiita, so I wrote it in Gist. https://gist.github.com/tyochiai/8817420

It's a terrible sample, but when I googled "Python download progress", for some reason I only got a sample that uses sys.stdout.write () (probably there is a source somewhere). ) Separately, it is a sample that print () can be used.

If you pass a function to the argument reporthook, ʻurlretrieve ()` will call it by passing the current number of blocks, block size, and total download size to the argument every time you download one block.

By the way, it's ʻurlretrieve () `, but the documentation says that it's classified as a legacy interface and may disappear soon (in fact, some methods have been deprecated in 3.3). At that time, will an alternative method be prepared?

Recommended Posts

Download the file while viewing the progress in Python 3.x
Download the file in Python
Save the binary file in Python
Read the file line by line in Python
Read the file line by line in Python
[Python] Read the specified line in the file
Get the X Window System window title in Python
The one that displays the progress bar in Python
I want to display the progress in Python!
File operations in Python
File processing in Python
Parallel download in Python
File operations in Python
Find the difference in Python
Download csv file with python
[Python] Open the csv file in the folder specified by pandas
Change the standard output destination to a file in Python
Get the MIME type in Python and determine the file format
The story that `while queue` did not work in python
Get the value while specifying the default value from dict in Python
[Note] Import of a file in the parent directory in Python
After enabling the python virtual environment in the batch file, run the python file
Google search for the last line of the file in Python
Specify the encoding of the unicode string in the Python 2.x print statement
How is the progress? Let's get on with the boom ?? in Python
Extract the xz file with python
Getting the arXiv API in Python
File / folder path manipulation in Python
Python in the browser: Brython's recommendation
Implemented file download with Python + Bottle
Hit the Sesami API in Python
Linebot creation & file sharing in Python
Get the desktop path in Python
Progress bar in pop-up in Python Kivy
Download Google Drive files in Python
Get the script path in Python
In the python command python points to python3.8
Implement the Singleton pattern in Python
Create a binary file in Python
Download the file deployed with appcfg.py
Sort the file names obtained by Python glob in numerical order
The story of the "hole" in the file
Hit the web API in Python
Read a file in Python with a relative path from the program
Extract the targz file using python
I wrote the queue in Python
Calculate the previous month in Python
Examine the object's class in python
Get the desktop path in Python
ORC, Parquet file operations in Python
Get the host name in Python
Access the Twitter API in Python
Get the formula in an excel file as a string in Python
The first step in Python Matplotlib
I wrote the stack in Python
Trial of writing the configuration file in Python instead of .ini etc.
Master the weakref module in Python
Upload & download wav file to X server (X-Server) by FTP with Python
A memo organized by renaming the file names in the folder with python
Download the file by specifying the download destination with Python & Selemiun & Chrome (Windows version)
Test & Debug Tips: Create a file of the specified size in Python