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