-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support to BaseClient for blob upload
* change BaseClientV2._http_response to accept bindata which is passed directly to requests * add _Manifest.from_file to support loading a manifest from a file then calling put_manifest * add BaseClientV2.put_blob based on implementation in python-dxf
- Loading branch information
Matthew Stoltenberg
committed
May 16, 2018
1 parent
8abf6b0
commit de22e58
Showing
4 changed files
with
74 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import hashlib | ||
|
||
|
||
def docker_digest(fpath=None, fobj=None, prepend=True): | ||
if fobj is None: | ||
fobj = open(fpath, 'rb') | ||
hasher = hashlib.sha256() | ||
for chunk in iter(lambda: fobj.read(8192), b''): | ||
hasher.update(chunk) | ||
fobj.seek(0) | ||
retval = hasher.hexdigest() | ||
if prepend: | ||
retval = 'sha256:' + retval | ||
return retval |
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ deps = | |
docker-py==1.10.6 | ||
flexmock==0.10.2 | ||
pytest==3.0.5 | ||
ecdsa==0.13 | ||
|
||
[testenv:lint] | ||
deps = | ||
|