From d338de8887f421ff5c48fbd4ead36cfe0b1f98a4 Mon Sep 17 00:00:00 2001 From: amit-62 Date: Wed, 6 Jul 2022 23:14:34 +0530 Subject: [PATCH 1/3] added download method --- fri/test.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fri/test.py b/fri/test.py index aba9f95..f27af1a 100644 --- a/fri/test.py +++ b/fri/test.py @@ -1,5 +1,6 @@ import requests import os +import webbrowser # function to test upload() method. def upload(): @@ -36,9 +37,12 @@ def execute(): return response.text - # ******** - # To Download call the url .../download/test?fetch=&apikey=xyz +# or +def download(): + url = "http://127.0.0.1:5000/download/test?fetch=f1.txt&apikey=xyz" + webbrowser.open(url) upload() execute() +download() From 27804bb77065b8b76f9f71e91e9b604c8df555d6 Mon Sep 17 00:00:00 2001 From: amit-62 Date: Thu, 7 Jul 2022 22:09:06 +0530 Subject: [PATCH 2/3] updated download test --- fri/test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fri/test.py b/fri/test.py index f27af1a..2d17159 100644 --- a/fri/test.py +++ b/fri/test.py @@ -1,6 +1,6 @@ import requests import os -import webbrowser +import urllib.request # function to test upload() method. def upload(): @@ -16,7 +16,7 @@ def upload(): response = requests.request("POST", url, headers=headers, data=payload, files=files) - return response.text + print(response.text) # # ******* @@ -35,12 +35,12 @@ def execute(): response = requests.request("POST", url, headers=headers, data=payload, files=files) - return response.text + print(response.text) # or def download(): url = "http://127.0.0.1:5000/download/test?fetch=f1.txt&apikey=xyz" - webbrowser.open(url) + urllib.request.urlretrieve(url, "f1.txt") upload() execute() From 598b23be1591e6064455094f9903f429b2517017 Mon Sep 17 00:00:00 2001 From: amit-62 Date: Thu, 7 Jul 2022 22:14:47 +0530 Subject: [PATCH 3/3] updated download test --- fri/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fri/test.py b/fri/test.py index 2d17159..4717aea 100644 --- a/fri/test.py +++ b/fri/test.py @@ -37,7 +37,7 @@ def execute(): print(response.text) -# or +# function to test download() method. def download(): url = "http://127.0.0.1:5000/download/test?fetch=f1.txt&apikey=xyz" urllib.request.urlretrieve(url, "f1.txt")