Files¶
class
_incydr_sdk.files.client.FilesV1
(parent)Client for /v1/files
endpoints.
Usage example:
>>> import incydr
>>>
>>> client = incydr.Client(**kwargs)
>>> client.files.v1.download_file_by_sha256("example_hash", "./testfile.test")
download_file_by_sha256
(self, sha256, target_path)Download a file that matches the given SHA256 hash.
Parameters:
- sh256:
str
(required) The SHA256 hash matching the file you wish to download. - target_path:
Path | str
a string orpathlib.Path
object that represents the target file path and name to which the file will be saved to.
Returns: A pathlib.Path
object representing the location of the downloaded file.
stream_file_by_sha256
(self, sha256)Stream a file that matches the given SHA256 hash.
Example usage:
>>> with sdk.files.v1.stream_file_by_sha256("example_hash") as response:
>>> with open("./testfile.zip", "wb") as file:
>>> for chunk in response.iter_content(chunk_size=128):
>>> file.write(chunk)
Parameters:
- sh256:
str
(required) The SHA256 hash matching the file you wish to download.
Returns: A requests.Response
object with a stream of the requested file.