How to scrape a website HTML using requests
Land Your First Data Science Job
A proven roadmap to prepare for $75K+ entry-level data roles. Perfect for Data Scientist ready to level up their career.
The requests library is probably one of the simplest library to use when you want to execute an HTTP call from Python script.
Asking for raw HTML
Some website will give you raw HTML only, because they are not supposed to give you a JSON back. It is the example with facebook.com
And if you print the response.text it will print out the html content that your call retrieved.
In order to properly work with your data you will need now to parse the HTML.
You can do that using Beautiful Soup library in Python
Land Your First Data Science Job
A proven roadmap to prepare for $75K+ entry-level data roles. Perfect for Data Scientist ready to level up their career.
Related Articles
Continue your learning journey with these related topics
Master Data Science in Days, Not Months 🚀
Skip the theoretical rabbit holes. Get practical data science skills delivered in bite-sized lessons – Approach used by real data scientist. Not bookworms. 📚