I am trying to upload a folder using post request in python....
What i am trying to do?
@staticmethod
def upload_folder(root_url, file_name, username, password):
url = root_url + '/upload'
token = get_token(root_url, username, password)
headers = {'content-type': 'multipart/form-data',
'accept': 'application/json',
'Authorization': 'something' + token}
files = {
'file': ('folder.zip;type', open('C:/path/folder.zip', 'rb')),
'filename': 'package1'
}
data = json.dumps{'file_name': file_name}
result = requests.post(url, headers=headers, files=files, data=data)
return result.content.decode()
I have to enter the below details in the swagger,
file_name, folder in zip format...
I somehow think that the files parameter is passed wrong or is there some other way to pass folders....Could someone help me with this? thanks...