Import fileinput
From warcio.archiveiterator import archiveiterator
Import requests

S = requests.session()
Unknownerror = "unknown exception"
Loadingerror = "error loading stats"

Def dostuff(uri):
Numiteration = 0
While numiteration < 11:
R = s.get(uri)
If unknownerror in r.text or loadingerror in r.text:
Print("failed {} status code = {}".format(numiteration, r.status_code))
Numiteration += 1
Del r
If numiteration == 11:
Print("failed to get target url")
Else:
Print("got something")
Break

Url = "http://halo.bungie.net/stats/reach/filedetails.aspx?fid=27420420"
Dostuff(url)