To write: if you are in the Python shell , try starting a new one. . I know this is not the question, but this is the only top hit from google for this error. The original cause of the problem is still not clear, since curl from the command line loaded the same URL without any problems, and I did not have network problems in any other application at the same time. I made ip link set <ifname> down/up , nmcli con down/up wired without success. I added some of the domains to /etc/hosts , this time did not resolve the problem, but later it worked in another domain. Here is a minimal example for simple testing:
import pycurl import io s = io.BytesIO() c = pycurl.Curl() c.setopt(pycurl.FOLLOWLOCATION, 1) c.setopt(pycurl.VERBOSE, 1) c.setopt(pycurl.WRITEFUNCTION, s.write) c.setopt(pycurl.URL, 'http://speedtest.ftp.otenet.gr/files/test100k.db') c.perform() s.seek(0) print('Downloaded %u bytes.' % len(s.getvalue()))
source share