Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Adjust upload_document() to consume also a stream input #112

Open
evelyn9191 opened this issue Jun 30, 2020 · 0 comments
Open

Adjust upload_document() to consume also a stream input #112

evelyn9191 opened this issue Jun 30, 2020 · 0 comments

Comments

@evelyn9191
Copy link
Member

In addition of uploading the document from a file (the case of local file system), it may be beneficial to have also a stream input (in our case of remote file system). More precisely, in this function:

    def upload_document(
        self, id_: int, file: str, filename_overwrite: str = "", values: Dict[str, str] = None
    ) -> dict:
        filename = PurePath(filename_overwrite).name or PurePath(file).name
        files: RequestsFiles = {"content": (filename, open(f"{file}", "rb"))}
        if values is not None:
            files["values"] = (None, json.dumps(values))
        return get_json(self.post(f"queues/{id_}/upload", files=files))

it would be great to feed also ByteIO stream, not only file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant