Skip to content

Commit

Permalink
- changing android download to common download function
Browse files Browse the repository at this point in the history
  • Loading branch information
riz-hossain committed Apr 12, 2020
1 parent bba5ecf commit 18e2e57
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Windows/TestNode_AndroidSetup_Windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ def Get_Home_Dir():
sys.stdout.error("\tAn error occurred. See log for more details: %s\n"%Error_Detail, True)
return False






def Download_File(base_url, file_name,md5=False):
try:

Expand All @@ -145,13 +150,18 @@ def Download_File(base_url, file_name,md5=False):

file_url = base_url + file_name
download_path = Get_Home_Dir()+os.sep + 'Downloads' + os.sep + file_name

download_path_complete = CommonUtils.Download_File(file_url, download_path)


'''
some times files gets corrpt and we need to re-download
if os.path.isfile(download_path):
#print "already downloading... skipping download"
sys.stdout.write("already downloading... skipping download", True)
return download_path
'''
'''
r = requests.get(file_url, stream=True)
path = download_path
with open(path, 'wb') as f:
Expand All @@ -161,8 +171,11 @@ def Download_File(base_url, file_name,md5=False):
f.write(chunk)
f.flush()
f.close()
'''
sys.stdout.write("Download completed", True)
return download_path
return download_path_complete

except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
Expand Down

0 comments on commit 18e2e57

Please sign in to comment.