l.s.l.c.FileDownloadClient : class documentation

Part of lp.services.librarian.client View In Hierarchy

Known subclasses: lp.services.librarian.client.LibrarianClient

A simple client to download files from the librarian
Method getURLForAlias Returns the url for talking to the librarian about the given
Method getURLForAliasObject Return the download URL for a LibraryFileAlias.
Method getFileByAlias See IFileDownloadClient.
Method _getAlias Retrieve the LibraryFileAlias with the given id.
Method _checkAliasAccess Verify that alias can be accessed.
Method _getPathForAlias Returns the path inside the librarian to talk about the given
Method _getPathForAliasObject Returns the Librarian path for a LibraryFileAlias.
Method _getBaseURL Get the base URL to use for alias.
Method _getURLForDownload Returns the internal librarian URL for the alias.
Method _connect_read Helper for getFileByAlias.
def _getAlias(self, aliasID, secure=False):
Retrieve the LibraryFileAlias with the given id.
ParametersaliasIDA unique ID for the alias.
secureControls the behaviour when looking up restricted files. If False restricted files are only permitted when self.restricted is True. See getURLForAlias.
ReturnsA LibraryFileAlias.
RaisesDownloadFailed if the alias is invalid or inaccessible.
def _checkAliasAccess(self, alias, secure=False):
Verify that alias can be accessed.
ParametersaliasA LibraryFileAlias.
secureControls the behaviour when looking up restricted files. If False restricted files are only permitted when self.restricted is True. See getURLForAlias.
RaisesDownloadFailed if access is not allowed.
def _getPathForAlias(self, aliasID, secure=False):
Returns the path inside the librarian to talk about the given alias.
ParametersaliasIDA unique ID for the alias
secureControls the behaviour when looking up restricted files. If False restricted files are only permitted when self.restricted is True. See getURLForAlias.
ReturnsString path, url-escaped. Unicode is UTF-8 encoded before url-escaping, as described in section 2.2.5 of RFC 2718. None if the file has been deleted.
RaisesDownloadFailed if the alias is invalid
def _getPathForAliasObject(self, alias):
Returns the Librarian path for a LibraryFileAlias.
def _getBaseURL(self, alias, secure=False):
Get the base URL to use for alias.
ParameterssecureIf true generate https urls on unique domains for security.
def getURLForAlias(self, aliasID, secure=False):
Returns the url for talking to the librarian about the given alias.
ParametersaliasIDA unique ID for the alias
secureIf true generate https urls on unique domains for security.
ReturnsString URL, or None if the file has expired and been deleted.
def getURLForAliasObject(self, alias, secure=False):
Return the download URL for a LibraryFileAlias.

There is a separate getURLForAlias that takes an alias ID. If you're not sure whether it's safe for the client to access your alias, use getURLForAlias which will retrieve its own copy.

ParametersaliasA LibraryFileAlias whose URL you want.
secureIf true generate https urls on unique domains for security.
ReturnsString URL, or None if the file has expired and been deleted.
def _getURLForDownload(self, aliasID):
Returns the internal librarian URL for the alias.
ParametersaliasIDA unique ID for the alias
ReturnsString URL, or None if the file has expired and been deleted.
def getFileByAlias(self, aliasID, timeout=LIBRARIAN_SERVER_DEFAULT_TIMEOUT):
See IFileDownloadClient.
def _connect_read(self, url, try_until, aliasID):
Helper for getFileByAlias.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.