13.12. Bonus section for Unix / Linux users¶
If you have a Linux, Unix, or Macintosh computer, you probably have
commands built in to your operating system that retrieves both plain
text and binary files using the HTTP or File Transfer (FTP) protocols.
One of these commands is
$ curl -O http://www.py4e.com/cover.jpg
curl is short for “copy URL” and so the two
examples listed earlier to retrieve binary files with
are cleverly named
they implement similar functionality to the
There is also a
curl3.py sample program that does this task
a little more effectively, in case you actually want to use this pattern
in a program you are writing.
A second command that functions very similarly is
$ wget http://www.py4e.com/cover.jpg
Both of these commands make retrieving webpages and remote files a simple task.