Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 37 additions & 9 deletions fri/test.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@
import requests
import os

url = "http://127.0.0.1:5000/multiple-files-upload"
# function to test upload() method.
def upload():
url = "http://127.0.0.1:5000/upload/test?apikey=xyz"

path = os.path.abspath("example.py")
path = os.path.abspath("example.py")

payload={}
files=[
('files[]',('example.py',open( path,'rb'),'application/octet-stream'))
]
headers = {}
payload={}
files=[
('files[]',('example.py',open(path,'rb'),'application/octet-stream'))
]
headers = {}

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

return response.text


# # *******

# function to test execute() method.
def execute():
url = "http://127.0.0.1:5000/execute/test?apikey=xyz"

path = os.path.abspath("example.py")

payload={}
files=[
('file',('example.py',open(path,'rb'),'application/octet-stream'))
]
headers = {}

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

return response.text

# ********
# To Download call the url .../download/test?fetch=<filename>&apikey=xyz

upload()
execute()

print(response.text)