This is a slightly more advanced example, where we query for articles.

from hoverpy import capture
import requests
import time

@capture("readthedocs.db", recordMode="once")
def getLinks(limit):
    start = time.time()
    sites = requests.get(
        "" % int(limit))
    objects = sites.json()['objects']

    for link in ["" + x['resource_uri'] for x in objects]:
        response = requests.get(link)
        print("url: %s, status code: %s" % (link, response.status_code))

    print("Time taken: %f" % (time.time() - start))

python examples/readthedocs/

The first time this command is invoked it takes Time taken: 7.658194. The second time we run it, Time taken: 0.093647. Please note this uses the recordMode="once" which is legacy from Ruby’s VCR and Python’s