change requests into function urlopen