Chapter 3

Interacting with the Internet

IN THIS CHAPTER

check Understanding how the web works

check Opening web pages from Python

check Using Python to post to the web

check Web scraping with Python

As you probably know, the Internet is home to virtually all the world’s knowledge. Most of us use the web all the time to find information. We do so using a web browser such as 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 such as 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 accessing the web programmatically with Python: urllib and BeautifulSoup.

Seeing How ...

Get Python All-in-One For Dummies, 2nd Edition 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.