コード例 #1
0
 def __init__(self,
              url,
              fileOrName,
              method="GET",
              postdata=None,
              cookies={},
              headers=None,
              agent=None,
              timeout=None):
     # XXX re-add support for cookies and timeout to HTTPDownloader call
     HTTPDownloader.__init__(self,
                             url,
                             fileOrName,
                             method=method,
                             postdata=postdata,
                             headers=headers,
                             agent=agent)
     self.value = {
         "startTime": time.time(),
         "timeToConnect": 0,
         "timeToFirstByte": 0,
         "elapsedTime": 0,
         "bytesTransferred": 0,
     }
     self.cookies = cookies
     self.timeout = timeout
コード例 #2
0
    def __init__(self, url, fileOrName, writeProgress=None, *args, **kwargs):
        HTTPDownloader.__init__(self, url, fileOrName, supportPartial=0, *args, **kwargs)
        # Save callback(s) locally
        if writeProgress and not isinstance(writeProgress, list):
            writeProgress = [writeProgress]
        self.writeProgress = writeProgress

        # Initialize
        self.currentlength = 0
        self.totallength = None
コード例 #3
0
ファイル: dhnnet.py プロジェクト: vesellov/datahaven
    def __init__(self, url, fileOrName, writeProgress = None, *args, **kwargs):
        HTTPDownloader.__init__(self, url, fileOrName, supportPartial=0, *args, **kwargs)
        # Save callback(s) locally
        if writeProgress and type(writeProgress) is not list:
            writeProgress = [ writeProgress ]
        self.writeProgress = writeProgress

        # Initialize
        self.currentlength = 0
        self.totallength = None
コード例 #4
0
    def __init__(self, url, fileOrName, writeProgress=None, *args, **kwargs):
        HTTPDownloader.__init__(self, url, fileOrName, *args, **kwargs)

        # Save callback(s) locally
        if writeProgress and type(writeProgress) is not list:
            writeProgress = [writeProgress]
        self.writeProgress = writeProgress

        # Initialize
        self.currentlength = 0
        self.totallength = None
コード例 #5
0
ファイル: base.py プロジェクト: unshift/thundercloud
 def __init__(self, url, fileOrName, method="GET", postdata=None, cookies={}, headers=None, agent=None, timeout=None):
     # XXX re-add support for cookies and timeout to HTTPDownloader call
     HTTPDownloader.__init__(self, url, fileOrName, method=method, postdata=postdata, headers=headers, agent=agent)
     self.value = {
         "startTime": time.time(),
         "timeToConnect": 0,
         "timeToFirstByte": 0,
         "elapsedTime": 0,
         "bytesTransferred": 0,
     }
     self.cookies = cookies
     self.timeout = timeout
コード例 #6
0
ファイル: http.py プロジェクト: dconnolly/Downpour
    def __init__(self, url, file, statusCallback=None, bucketFilter=None, *args, **kwargs):
        self.bytes_received = 0
        self.statusHandler = statusCallback
        self.bucketFilter = bucketFilter

        # TODO: Apparently this only works for servers, not clients :/
        #if self.bucketFilter:
        #   self.protocol = ShapedProtocolFactory(self.protocol, self.bucketFilter)

        HTTPDownloader.__init__(self, url, file, supportPartial=1,
                                agent='Downpour v%s' % VERSION,
                                *args, **kwargs)

        self.origPartial = self.requestedPartial
コード例 #7
0
ファイル: http.py プロジェクト: Saectar/downpour
    def __init__(self, url, file, statusCallback=None, bucketFilter=None, *args, **kwargs):
        self.bytes_received = 0
        self.encoding = None
        self.statusHandler = statusCallback
        self.bucketFilter = bucketFilter

        # TODO: Apparently this only works for servers, not clients :/
        #if self.bucketFilter:
        #   self.protocol = ShapedProtocolFactory(self.protocol, self.bucketFilter)

        HTTPDownloader.__init__(self, url, file, supportPartial=1,
                                agent='Downpour v%s' % VERSION,
                                *args, **kwargs)

        self.origPartial = self.requestedPartial