Chapter 3

Interacting with the Internet


Bullet How the Web works

Bullet Opening web pages from Python

Bullet Posting to the Web with Python

Bullet Web scraping with Python

As you probably know, the Internet is home to virtually all the world’s knowledge. Most of us use the World Wide Web (a.k.a. the Web) to find information all the time. We do so using a web browser like Safari, Google Chrome, Firefox, Opera, Internet Explorer, or Edge. To visit a website, you type a URL (uniform resource locator) into your browser’s Address bar and press Enter, or you click a link that sends you to the page automatically.

As an alternative to browsing the Web with your web browser, you can access its content programmatically. In other words, you can use a programming language like Python to post information to the Web, as well as to access web information. In a sense, you make the Web your personal database of knowledge from which your apps can pluck information at will. In this chapter you learn about the two main modules for access the Web programmatically with Python: urllib and Beautiful Soup.

How the ...

Get Python All-in-One For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.