Is there any way to "hook" in or modify program to download file from cloud storage and inject it into Stdin with Python?

Viewed 16

I have a python program package I didn't write called Slither. I've installed package and there's a command I need to capture output but it only accepts a file path example

slither filename.sol

I want to put this behind a Django API and capture the output, modify it and return to user. The problem is I deployed app to Heroku which has ephemeral storage. I've chosen cloundary as cloud storage provider and plan to upload the file to Cloundary which is similar to AWS bucket.

This seems to work except then I get a uri back like say https://mybucket.cloundary.io/mybucket

The problem is slither does not accept this type of file path. I'm currently using:

 f"slither {'./files/'+filename} ", stderr=subprocess.STDOUT, shell=True, timeout=120,
        universal_newlines=True)

Is there a way too hook into process or modify this so I could do something like

f"slither {'https://mybucket.cloundary.io/mybucket'} ", stderr=subprocess.STDOUT, shell=True, timeout=120,
        universal_newlines=True)
0 Answers
Related