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

Is there a nice way to download files from Salesforce? #704

Open
piotrekkr opened this issue Jan 6, 2024 · 0 comments
Open

Is there a nice way to download files from Salesforce? #704

piotrekkr opened this issue Jan 6, 2024 · 0 comments

Comments

@piotrekkr
Copy link

Hello. Thanks for this great library. I noticed one "missing" feature that imho would make it better. I cannot easily download ContentVersion blob from Salesforce. I'm doing some nasty workaround like using _call_salesforce() like this:

result = client._call_salesforce(
    url="{base}/sobjects/ContentVersion/{id}/VersionData".format(
        base=self._simple_sf_client.base_url, id=version.id
    ),
    method="GET",
    headers={"Content-Type": "application/octet-stream"},
    stream=True,
)
#...
with open(download_path, "wb") as file:
    for chunk in result.iter_content(chunk_size=1024):
        if chunk:
            file.write(chunk)

Would be great to have a download method for doing this. Or maybe I missed something in docs and there is method like this already? Thanks 🙏

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