import http.client, os conn = http.client.HTTPConnection("archives.fedoraproject.org") conn.request("GET", "/pub/archive/fedora/linux/core/1/SRPMS/") r = conn.getresponse() with open("index2.html", "wb") as f: while True: buf = r.read(4096) if not buf: break f.write(buf)