l.s.l.i.c.IFileDownloadClient(Interface) : interface documentation

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

Known subclasses: lp.services.librarian.interfaces.client.ILibrarianClient

Download API for the Librarian client.
Method getURLForAlias Returns the URL to the given file.
Method getURLForAliasObject Returns the URL to a given LibraryFileAlias object.
Method getFileByAlias Returns a file-like object to read the file contents from.
def getURLForAlias(aliasID, secure=False):
Returns the URL to the given file.
ParametersaliasIDThe LibraryFileAlias for the file to get. A DB lookup will be done for this - if many are to be calculated, eagar loading is recommended.
secureIf False, generate an http url on the main librarian domain. If True, generate an https url on a subdomain i$aliasID.restricted.$main_librarian_domain. Note that when a secure URL is generated, a TimeLimitedToken must separately be obtained and combined with the URL to use it.
def getURLForAliasObject(alias):
Returns the URL to a given LibraryFileAlias object.

Use this with care. Do not pass the LibraryFileAlias object across process or thread boundaries. If you need to pass a LibraryFileAlias across a boundary, pass alias.id and use getURLForAlias instead.

def getFileByAlias(aliasID, timeout=LIBRARIAN_SERVER_DEFAULT_TIMEOUT):
Returns a file-like object to read the file contents from.
ParametersaliasIDThe alias ID identifying the file.
timeoutThe number of seconds the method retries to open a connection to the Librarian server. If the connection cannot be established in the given time, a LibrarianServerError is raised.
ReturnsA file-like object to read the file contents from.
RaisesDownloadFailedIf the alias is not found.
LibrarianServerErrorIf the librarian server is unreachable or returns an 5xx HTTPError.
API Documentation for Launchpad, generated by pydoctor at 2018-06-23 00:00:09.