Skip to content

Don't try to download if compression file isn't going to remain available #5

@joshkersey

Description

@joshkersey

I submitted a support ticket but wanted to raise the issue here, as well. We are making a request for a PDF to be compressed using the following code (simplified for brevity):

# Initiate the compression via Cloud Convert
process = cc_api.createProcess({
    "mode": "compress",
})

process.start({
    "mode": "compress",
    "input": "download",
    "file": self.pdf_file.url,
})

process.wait()

path = ...code to generate path to file...
process.download(path)

Sometimes, the process.wait() will receive a 200 response from the API with what appears to be a finished compression and all of the required attributes to generate a download. However, there's a message property in the JSON response that reads: We could not compress this file. It seems this file is already compressed.

When the process.download(path) is fired from self.api.rawCall("GET", ...) in process.py the request to download the file is returned a 404 response with a message of File already deleted. Use the 'save' parameter, otherwise files will be deleted after the first download..

In my mind, it doesn't make sense for the compression API to return a 200 if the download is not going to work. For now, I've modified our code to look for the message above but I feel like the original API response should be more explicit if the file is not going to be available.

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