rewrited, using urllib.request instead of http.client