Delay/defer functionality in jupyter notebook

  python

Trying to scrape a list of websites from jupyter notebook and below is the snippet

import requests as rqst
from bs4 import BeautifulSoup

urllist = [ list of urls both http and https]

results = []
for i in urllist:
    print(i)
    pagecontent = rqst.get(i)
    if (pagecontent.status_code == 200):
        results.append(pagecontent)

Is there a way to make the execution to wait for few seconds/ until a status_code is available before moving to the next iteration?

Source: Python Questions

LEAVE A COMMENT