sieve.File
Overview
sieve.File
is a utility class that helps with handling files that are inputs to a function
, produced locally in the file system, or downloaded from an external url.
The underlying contents in a sieve.File
are backed by Sieve’s file servers and are downloaded lazily, meaning that they will not download the content until requested with the path
property. This means that a sieve.File
can be passed around to different functions efficiently without having to deal with network overhead.
Constructor Optional Arguments
url
(str): The URL of the file to download.path
(str): The local path to the file.
A File
can be instantiated in two ways, either by providing a local file path, or an external url. You can either pass them in as positional arguments or as keyword arguments to path or url.
Properties
url
The url of the file, if it exists. This will return None if the file refers to something on the local filesystem.
path
The local path to the file. This will download the file if it is not downloaded already, and return the path of the downloaded file.
Note: If files are passed around within Sieve, they may not have a path or URL associated due to the lazy loading properties of Sieve files. To get a path to these files, simply run .path
on the sieve.File
object.
Usage
Python SDK
When pushing to Sieve via SDK, you can simplify pass in a sieve.File
instance as the argument to the function.
REST API
When pushing via API, you will define the input as a JSON struct similar to the following:
For the dubbing example, here is what an equivalent cURL request may look like:
Aside: For more information on Sieve Dubbing, check out the function here.
When retrieving outputs for the Sieve job, the structure will be the similar to the JSON format as described above, except contained within a “data” subfield in the object. We’ve attached a simplified job JSON below as retrieved from the Get Job endpoint.
Was this page helpful?