def _openUrl(self, url):
        oldTimeout = socket.getdefaulttimeout()
        timeout = 2
        socket.setdefaulttimeout(timeout)
        # Extra headers to send up
        headers = {
            'X-Conary-Version' : constants.version or "UNRELEASED",
            'X-Conary-Config-Version' : str(configVersion),
        }
        opener = self._getOpener()
        try:
            for i in range(4):
                try:
                    return opener.open(url, headers=headers)
                except socket.timeout:
                    # CNY-1161
                    # We double the socket time out after each run; this
                    # should allow very slow links to catch up while
                    # providing some feedback to the user. For now, only
                    # on stderr since logging is not enabled yet.
                    sys.stderr.write("Timeout reading configuration "
                        "file %s; retrying...\n" % url)
                    timeout *= 2
                    socket.setdefaulttimeout(timeout)
                    continue
                except (__HOLE__, socket.error), err:
                    if len(err.args) > 1:
                        raise CfgEnvironmentError(url, err.args[1])
                    else:
                        raise CfgEnvironmentError(url, err.args[0])
                except EnvironmentError, err:
                    raise CfgEnvironmentError(err.filename, err.msg)
            else: # for
                # URL timed out
                raise CfgEnvironmentError(url, "socket timeout")
        finally:
            socket.setdefaulttimeout(oldTimeout)
dataset/ETHPy150Open sassoftware/conary/conary/lib/cfg.py/ConfigFile._openUrl