connection, urlopen refactory