-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A new keyword allow to pass file descriptor to python requests, which allows to read a binary file directly without loading it into memory Signed-off-by: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
- Loading branch information
Showing
4 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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,7 @@ | ||
import base64 | ||
|
||
def base64_decode_data(s): | ||
# We expect base64 string retrieved from json.data(), which also includes | ||
# MIME headers in a form "data:application/octet-stream;base64,<ACTUAL BASE64 DATA>" | ||
# Therefore we strip the headers and decode the actual data | ||
return base64.b64decode(s.split(',')[1]) |
This file contains 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