Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Collaborator

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant