def url(self, name, headers=None, response_headers=None): # Preserve the trailing slash after normalizing the path. trailing_slash = '/' if name.endswith('/') else '' name = self._normalize_name(self._clean_name(name)) + trailing_slash if self.custom_domain: return "%s//%s/%s" % (self.url_protocol, self.custom_domain, filepath_to_uri(name)) return self.connection.generate_url(self.querystring_expire, method='GET', bucket=self.bucket.name, key=self._encode_name(name), headers=headers, query_auth=self.querystring_auth, force_http=not self.secure_urls, response_headers=response_headers)
def url(self, name): if self.base_url is None: raise ValueError("This file is not accessible via a URL.") return urljoin(self.base_url, filepath_to_uri(name))