Skip to content

Commit 15b20c8

Browse files
authored
Merge pull request #7 from amit-62/dev
added download method
2 parents 72fc6e4 + 598b23b commit 15b20c8

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

fri/test.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import requests
22
import os
3+
import urllib.request
34

45
# function to test upload() method.
56
def upload():
@@ -15,7 +16,7 @@ def upload():
1516

1617
response = requests.request("POST", url, headers=headers, data=payload, files=files)
1718

18-
return response.text
19+
print(response.text)
1920

2021

2122
# # *******
@@ -34,11 +35,14 @@ def execute():
3435

3536
response = requests.request("POST", url, headers=headers, data=payload, files=files)
3637

37-
return response.text
38+
print(response.text)
3839

39-
# ********
40-
# To Download call the url .../download/test?fetch=<filename>&apikey=xyz
40+
# function to test download() method.
41+
def download():
42+
url = "http://127.0.0.1:5000/download/test?fetch=f1.txt&apikey=xyz"
43+
urllib.request.urlretrieve(url, "f1.txt")
4144

4245
upload()
4346
execute()
47+
download()
4448

0 commit comments

Comments
 (0)