Skip to content

Commit 1318bdc

Browse files
committed
semicolon
1 parent c11450b commit 1318bdc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

mglib/mglib.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import json
99
import string
1010
import random
11+
import hashlib
1112
import subprocess
1213
try:
1314
from StringIO import StringIO
@@ -100,13 +101,17 @@ def obj_from_url(url, auth=None, data=None, debug=False, method=None):
100101
return obj
101102

102103
# print to file results of MG-RAST or Shock API
103-
def file_from_url(url, handle, auth=None, data=None, debug=False):
104+
def file_from_url(url, handle, auth=None, data=None, debug=False, sha1=False):
104105
result = body_from_url(url, 'text/plain', auth=auth, data=data, debug=debug)
106+
sha1hash = hashlib.sha1()
105107
while True:
106108
chunk = result.read(8192)
107109
if not chunk:
108110
break
111+
if sha1:
112+
sha1hash.update(chunk)
109113
handle.write(chunk.decode('utf8'))
114+
return sha1hash.hexdigest()
110115

111116
# print to stdout results of MG-RAST API
112117
def stdout_from_url(url, auth=None, data=None, debug=False):

0 commit comments

Comments
 (0)