March 2018
Beginner to intermediate
422 pages
10h 33m
English
Let's now build a simple Weather Reporter application. The weather data for any given location will be fetched from the network, suitably formatted, and presented to the user.
We will use a higher level module named urllib to fetch weather data from the web. The urllib module is part of Python's standard library and it provides an easy to use API for working with URLs. It has four submodules:
With urllib.request, fetching the contents of a web page turns into three lines of code (see 9.05_urllib_demo.py):
import ...