This commit is contained in:
utahta
2011-08-07 12:58:54 +09:00
parent 4993f466e9
commit bc219fcebe
11 changed files with 34 additions and 19 deletions
+4 -3
View File
@@ -4,6 +4,7 @@ import subprocess
from subprocess import Popen, PIPE
from pythonbrew.log import logger
from pythonbrew.util import to_str
from pythonbrew.exceptions import CurlFetchException
class Curl(object):
def __init__(self):
@@ -16,14 +17,14 @@ class Curl(object):
p = Popen("curl -skL %s" % url, stdout=PIPE, shell=True)
p.wait()
if p.returncode:
raise
raise Exception('Failed to read.')
return p.stdout.read()
def readheader(self, url):
p = Popen("curl --head -skL %s" % url, stdout=PIPE, shell=True)
p.wait()
if p.returncode:
raise
raise Exception('Failed to readheader.')
respinfo = {}
for line in p.stdout:
line = to_str(line.strip())
@@ -39,4 +40,4 @@ class Curl(object):
p = Popen("curl -# -kL %s -o %s" % (url, filename), shell=True)
p.wait()
if p.returncode:
raise
raise CurlFetchException('Failed to fetch.')