def upload(self, url, abs_path, auth=None, dedup=False, retry=1, retry_wait=0, headers=None):
    headers = (headers or {})
    headers['X-Checksum-Sha1'] = sha1sum(abs_path)
    if dedup:
        dedup_headers = {'X-Checksum-Deploy': 'true'}
        if headers:
            dedup_headers.update(headers)
        response = self.requester.put(url, data='', verify=self.verify, headers=dedup_headers, auth=auth)
        if (response.status_code == 403):
            if (auth.token is None):
                raise AuthenticationException(response.content)
            raise ForbiddenException(response.content)
        if (response.status_code == 201):
            return response
    self.output.info('')
    it = load_in_chunks(abs_path, self.chunk_size)
    file_size = os.stat(abs_path).st_size
    it = upload_with_progress(file_size, it, self.chunk_size, self.output)
    iterable_to_file = IterableToFileAdapter(it, file_size)
    ret = call_with_retry(self.output, retry, retry_wait, self._upload_file, url, data=iterable_to_file, headers=headers, auth=auth)
    return ret
def upload(self, url, abs_path, auth=None, dedup=False, retry=1, retry_wait=0, headers=None):
    headers = (headers or {})
    headers['X-Checksum-Sha1'] = sha1sum(abs_path)
    if dedup:
        dedup_headers = {'X-Checksum-Deploy': 'true'}
        if headers:
            dedup_headers.update(headers)
        response = self.requester.put(url, data=, verify=self.verify, headers=dedup_headers, auth=auth)
        if (response.status_code == 403):
            if (auth.token is None):
                raise AuthenticationException(response.content)
            raise ForbiddenException(response.content)
        if (response.status_code == 201):
            return response
    self.output.info()
    it = load_in_chunks(abs_path, self.chunk_size)
    file_size = os.stat(abs_path).st_size
    it = upload_with_progress(file_size, it, self.chunk_size, self.output)
    iterable_to_file = IterableToFileAdapter(it, file_size)
    ret = call_with_retry(self.output, retry, retry_wait, self._upload_file, url, data=iterable_to_file, headers=headers, auth=auth)
    return ret