예제 #1
0
파일: curl.py 프로젝트: npinto/pythonbrew
 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
예제 #2
0
def get_stable_version():
    c = Curl()
    return u(c.read(PYTHONBREW_STABLE_VERSION_URL).strip())