-
Notifications
You must be signed in to change notification settings - Fork 17
perf: Skip request-body compression for already-compressed content types #987
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
7 commits
Select commit
Hold shift + click to select a range
810f414
perf: Skip request-body compression for already-compressed content types
vdusek d88cf4e
docs: Move the skip-compression example into dedicated code files
vdusek e651bac
fix: Compress raw media types that sit under an already-compressed pr…
vdusek 286f68b
fix: Drop caller Content-Encoding whenever the request body is not co…
vdusek 928a160
docs: Clarify which payloads skip request-body compression
vdusek 0fc79b5
Merge remote-tracking branch 'origin/master' into feat/skip-compressi…
vdusek be16625
fix: Compress audio/L24 and audio/midi request bodies
vdusek 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import asyncio | ||
| from pathlib import Path | ||
|
|
||
| from apify_client import ApifyClientAsync | ||
|
|
||
| TOKEN = 'MY-APIFY-TOKEN' | ||
|
|
||
|
|
||
| async def main() -> None: | ||
| apify_client = ApifyClientAsync(TOKEN) | ||
| kvs_client = apify_client.key_value_store('MY-KVS-ID') | ||
|
|
||
| screenshot = await asyncio.to_thread(Path('screenshot.png').read_bytes) | ||
|
|
||
| # The explicit content type lets the client skip compressing the PNG. | ||
| await kvs_client.set_record('screenshot', screenshot, content_type='image/png') | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| asyncio.run(main()) |
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,15 @@ | ||
| from pathlib import Path | ||
|
|
||
| from apify_client import ApifyClient | ||
|
|
||
| TOKEN = 'MY-APIFY-TOKEN' | ||
|
|
||
|
|
||
| def main() -> None: | ||
| apify_client = ApifyClient(TOKEN) | ||
| kvs_client = apify_client.key_value_store('MY-KVS-ID') | ||
|
|
||
| screenshot = Path('screenshot.png').read_bytes() | ||
|
|
||
| # The explicit content type lets the client skip compressing the PNG. | ||
| kvs_client.set_record('screenshot', screenshot, content_type='image/png') |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.