Skip to content

Improvement: Split download_attachment into 2 functions #387

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

Open
herronelou opened this issue Jun 2, 2025 · 2 comments
Open

Improvement: Split download_attachment into 2 functions #387

herronelou opened this issue Jun 2, 2025 · 2 comments

Comments

@herronelou
Copy link

Hi.

We often need to download SG thumbnails from the thumbnail's URL.

We wrote code to do that which is essentially duplicated code from sg.download_attachment, the main difference being that instead of passing in an attachment, we directly pass the URL that the function extracts at

url = self.get_attachment_download_url(attachment)

Could we split the code into 2 functions, one to download by URL, and one to download by attachment, as it's essentially the same code?

I can put an MR if you're not against the idea.

@herronelou
Copy link
Author

Also #343 had broken our own copy the the code, which is what prompted this idea so we don't need to maintain a separate branch..

@julien-lang
Copy link
Contributor

Hello @herronelou, I'm sorry my #343 PR broke your code. I don't remember the details about it, but I did not think this method was used externally.

Anyway, I think your suggestion is a good idea, and we would be happy to review your contribution in a PR.

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

2 participants