def readheader(self, url): p = Popen("curl --head -skL %s" % url, stdout=PIPE, shell=True) p.wait() if p.returncode: raise respinfo = {} for line in p.stdout: line = u(line.strip()) if re.match('^HTTP.*? 200 OK$', line): break for line in p.stdout: line = u(line.strip()).split(":", 1) if len(line) == 2: respinfo[line[0].strip().lower()] = line[1].strip() return respinfo
def get_stable_version(): c = Curl() return u(c.read(PYTHONBREW_STABLE_VERSION_URL).strip())