Python: Using requests to get web page source text

In addition to getting page lengths and status codes using the request method: Python: Using requests to get web page lengths and status codes You can also use requests to return the source code of web pages. For example: import requests sites = [ ‘http://www.python.org’, ‘http://www.jython.org’, ‘http://www.pypy.org’, ‘http://www.drudgereport.com’, ‘http://www.phys.org’, ‘http://www.bluegalaxy.info’, ‘http://www.bluegalaxy.info/codewalk’ ] for url in … Continue reading Python: Using requests to get web page source text

Python: Using requests to get web page lengths and status codes

With Python 3.6 and the requests module, it is easy to read data from the web. Here are a couple of basic things we can do with the requests module. 1. Getting a Status code: import requests r = requests.get(‘http://www.bluegalaxy.info’) print( r.status_code ) Which yields: 200 For more information about HTTP status codes, there are … Continue reading Python: Using requests to get web page lengths and status codes