-
Notifications
You must be signed in to change notification settings - Fork 9
Feature: download on ipfs client #36
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
197899a
Feature: download on ipfs client
1yam 6ab843b
Update src/aleph/sdk/client.py
1yam 993b12a
Update src/aleph/sdk/client.py
1yam ac5d869
Update src/aleph/sdk/client.py
1yam 2898e52
Fix: Pr change
1yam cea3efb
Merge remote-tracking branch 'refs/remotes/origin/1yam-download_ipfs-…
1yam f9b76bc
Fix: Handle IPFS downloads in download_file_to_buffer.
1yam b30cf00
Fix: Useless code
1yam 067c63b
Fix: Handle IPFS downloads in download_file_to_buffer when return 413.
1yam d180dba
Fix: Remove chunk_size from paramater
1yam cb8c271
Refactor: download ipfs & aleph on same function
1yam 5a066dc
Fix: Error Handling
1yam 1004c8c
Refactor: Encapsulate read and write of the download (ipfs & aleph)
1yam 254379a
Fix: cleaning the code
1yam c3d18a6
Fix: variable name
1yam b3e9f1d
Merge branch 'main' into 1yam-download_ipfs-rebased
1yam 7d4b2ba
Feature: Download on ipfs client
1yam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import pytest | ||
| from aleph.sdk import AlephClient | ||
| from aleph.sdk.conf import settings as sdk_settings | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "file_hash,expected_size", | ||
| [ | ||
| ("QmeomffUNfmQy76CQGy9NdmqEnnHU9soCexBnGU3ezPHVH", 5), | ||
| ("Qmdy5LaAL4eghxE7JD6Ah5o4PJGarjAV9st8az2k52i1vq", 5817703), | ||
| ], | ||
| ) | ||
| @pytest.mark.asyncio | ||
| async def test_download(file_hash: str, expected_size: int): | ||
| async with AlephClient(api_server=sdk_settings.API_HOST) as client: | ||
| file_content = await client.download_file(file_hash) # File is 5B | ||
| file_size = len(file_content) | ||
| assert file_size == expected_size | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "file_hash,expected_size", | ||
| [ | ||
| ("QmeomffUNfmQy76CQGy9NdmqEnnHU9soCexBnGU3ezPHVH", 5), | ||
| ("Qmdy5LaAL4eghxE7JD6Ah5o4PJGarjAV9st8az2k52i1vq", 5817703), | ||
| ], | ||
| ) | ||
| @pytest.mark.asyncio | ||
| async def test_download_ipfs(file_hash: str, expected_size: int): | ||
| async with AlephClient(api_server=sdk_settings.API_HOST) as client: | ||
| file_content = await client.download_file_ipfs(file_hash) ## 5817703 B FILE | ||
| file_size = len(file_content) | ||
| assert file_size == expected_size |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.