Ejemplo n.º 1
0
 def geturl(self, path, purpose="download"):
     _path = self.validatepath(path)
     _key = self._path_to_key(_path)
     if _path == "/":
         raise errors.NoURL(path, purpose)
     if purpose == "download":
         url = self.client.generate_presigned_url(
             ClientMethod="get_object",
             Params={"Bucket": self._bucket_name, "Key": _key},
         )
         return url
     else:
         raise errors.NoURL(path, purpose)
Ejemplo n.º 2
0
 def geturl(self, path, purpose='download'):
     _path = self.validatepath(path)
     _key = self._path_to_key(_path)
     if _path == '/':
         raise errors.NoURL(path, purpose)
     if purpose == 'download':
         url = self.client.generate_presigned_url(ClientMethod='get_object',
                                                  Params={
                                                      'Bucket':
                                                      self._bucket_name,
                                                      'Key': _key
                                                  })
         return url
     else:
         raise errors.NoURL(path, purpose)
Ejemplo n.º 3
0
 def geturl(self, path: str, purpose: str = "download"):
     # TODO This does currently not have the same functionality as S3FS.geturl() (returning a public URL) which may be confusing to users
     _path = self.validatepath(path)
     _key = self._path_to_key(_path)
     if purpose == "download":
         return "gs://" + self.DELIMITER.join([self._bucket_name, _key])
     else:
         raise errors.NoURL(path, purpose)
Ejemplo n.º 4
0
 def geturl(self, path, purpose='download'):  # noqa: D102
     _path = self.validatepath(path)
     if purpose != 'download':
         raise errors.NoURL(path, purpose)
     return "ssh://{}@{}:{}{}".format(self._user, self._host, self._port,
                                      _path)