May 2017
Beginner to intermediate
220 pages
5h 2m
English
The source code for the RedisCache class is available at https://github.com/kjam/wswp/blob/master/code/chp3/rediscache.py and, as with DiskCache, the cache can be tested with the link crawler in any Python interpreter. Here, we use IPython to employ the %time command:
In [1]: from chp3.advanced_link_crawler import link_crawlerIn [2]: from chp3.rediscache import RedisCacheIn [3]: %time link_crawler('http://example.webscraping.com/', '/(index|view)', cache=RedisCache())Downloading: http://example.webscraping.com/Downloading: http://example.webscraping.com/index/1Downloading: http://example.webscraping.com/index/2...Downloading: http://example.webscraping.com/view/Afghanistan-1CPU times: user 352 ms, sys: 32 ms, total: 384 ...Read now
Unlock full access