python reptile brush Visits

the urllib.request Import
Import Time

# use - the build_opener () is to allow the program to mimic python Browser access
opener urllib.request.build_opener = ()
opener.addheaders = [( 'the User-Agent', 'the Mozilla / 5.0')]


# brush a special page
print ( 'start brushing oh:')
tempUrl = 'https://www.cnblogs.com/lma0702/p/11106382.html'



for J in the Range (2000):
the try:
opener.open ( tempUrl)
the time.sleep (. 7)
Print ( '% S% D'% (J, tempUrl))
the except urllib.error.HTTPError:
Print ( 'urllib.error.HTTPError')
the time.sleep (. 1)
the except urllib.error .URLError:
Print ( 'urllib.error.URLError')
the time.sleep (. 1)

 

Guess you like

Origin www.cnblogs.com/lma0702/p/11326549.html