Skip to content

how to download file to local disk? #29

@CayoM

Description

@CayoM

The example of the api docs for python looks like:
t800File = client.file("data://.my/robots/T-800.png").getFile()

but no matter how i try to save the response I keep getting errors.

if i try to read the response in order to write to a file, i get this error:

    with open("test.png", "w") as f:
        f.write(response.read())

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

if i try to save the response directly, i get this:

    with open("test.png", "w") as f:
        f.write(response)

TypeError: write() argument must be str, not _io.TextIOWrapper

Any help is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions