def __init__(self,
               api,
               path,
               content_type=None,
               gcs_headers=None):
    assert self._maxrequestsize > self._blocksize
    assert self._maxrequestsize % self._blocksize == 0

    self._api = api
    self.name = path
    self.closed = False

    self._buffer = collections.deque()
    self._buffered = 0
    self._written = 0
    self._offset = 0

    headers = {'x-goog-resumable': 'start'}
    if content_type:
      headers['content-type'] = content_type
    if gcs_headers:
      headers.update(gcs_headers)
    status, resp_headers, _ = self._api.post_object(path, headers=headers)
    errors.check_status(status, [201], path, headers, resp_headers)
    loc = resp_headers.get('location')
    if not loc:
      raise IOError('No location header found in 201 response')
    parsed = urlparse.urlparse(loc)
    self._path_with_token = '%s?%s' % (self.name, parsed.query)
Constructor.
dataset/ETHPy150Open GoogleCloudPlatform/billing-export-python/cloudstorage/storage_api.py/StreamingBuffer.__init__