From the course: Python Projects

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Random Wikipedia articles

Random Wikipedia articles - Python Tutorial

From the course: Python Projects

Random Wikipedia articles

- [Instructor] To implement the final of my four content retrieval functions. I'll need to retrieve a random Wikipedia article from the web. So I checked to see if Wikipedia has an API, I could call it to do that. I searched Google for Wikipedia API documentation. And the second result gave me exactly what I was looking for. Wikipedia conveniently has a REST API, which can be used to access Wikimedia content, Expanding the page content section, and then scrolling down near the bottom of it, I see a description that sounds like get content for a random page. That sounds like exactly what I need. So I'll click on the get button and then click the try it out button. This allows me to then select the desired return format from the dropdown menu. It has options to get a random page title, the full page HTML, or just a summary of its key points. I don't need to include an entire Wikipedia article in my digest email, getting a summary sounds perfect for my needs. So I'll select that option…

Contents