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

Add method to download an attachment #181

Merged
merged 1 commit into from
Sep 17, 2024
Merged

Conversation

shrik450
Copy link
Collaborator

The browser_download_url property of attachments can be confusing, as it is a full URL and allspice.requests_get_raw doesn't work with absolute URLs. The new Attachment.download_to_file method provides a "blessed" way to download the attachment.

@shrik450 shrik450 requested a review from a team as a code owner September 16, 2024 13:25
@shrik450
Copy link
Collaborator Author

Paging @hercastspice 🫡

Copy link

Coverage Summary

Total Project Coverage

  • Line Coverage: 86.02% (1785/2075)
  • Branch Coverage: 73.62% (452/614)

Coverage by File

File Line Coverage Branch Coverage Lines (Covered/Total) Branches (Covered/Total)
allspice/__init__.py 100.00% 100.00% 5/5 0/0
allspice/allspice.py 81.43% 69.23% 171/210 54/78
allspice/apiobject.py 83.74% 60.87% 1035/1236 168/276
allspice/baseapiobject.py 87.25% 84.62% 89/102 44/52
allspice/exceptions.py 100.00% 100.00% 14/14 0/0
allspice/ratelimiter.py 100.00% 100.00% 22/22 4/4
allspice/utils/__init__.py 100.00% 100.00% 0/0 0/0
allspice/utils/bom_generation.py 99.11% 98.00% 111/112 49/50
allspice/utils/core.py 94.12% 50.00% 16/17 1/2
allspice/utils/list_components.py 89.77% 86.57% 272/303 116/134
allspice/utils/netlist_generation.py 92.59% 88.89% 50/54 16/18

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

  • allspice/apiobject.py (100%)

Summary

  • Total: 5 lines
  • Missing: 0 lines
  • Coverage: 100%

The browser_download_url property of attachments can be confusing, as it
is a full URL and `allspice.requests_get_raw` doesn't work with absolute
URLs. The new `Attachment.download_to_file` method provides a "blessed"
way to download the attachment.
@shrik450 shrik450 force-pushed the su/downlod-attachment branch from 9d574d9 to 28c72a6 Compare September 16, 2024 13:27
@hercastspice
Copy link

Thanks a lot!

Copy link
Contributor

@kdumontnu kdumontnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Maybe an integration test for this route?

@shrik450
Copy link
Collaborator Author

shrik450 commented Sep 16, 2024

LGTM. Maybe an integration test for this route?

We've got the test added here, but in py-allspice terms that's an API test so if that's not what you meant I can add something else.

@shrik450 shrik450 merged commit d1df1c8 into main Sep 17, 2024
4 checks passed
@shrik450 shrik450 deleted the su/downlod-attachment branch September 17, 2024 18:27
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

Successfully merging this pull request may close these issues.

4 participants