-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.py
22 lines (20 loc) · 1019 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
__author__ = 'tba5jb'
import requests
from django.core.files import File
from django.core.files.uploadedfile import SimpleUploadedFile
import json
if __name__ == "__main__":
# response = requests.get("http://127.0.0.1:8000/request/")
# csrf_token = str(response.headers['set-cookie']).split('=')[1].split(';')[0]
# data = {'csrfmiddlewaretoken': csrf_token}
# data = {}
# headers = {}
# command = queue.get()
# if(command.task == 'newFile'):
# files = {'file':[command.file, File(open('test.txt', 'rb'))]}
# response = requests.post("http://127.0.0.1:8000/request/", files=files)
#data = {'user_name': 'admin', 'password': 'password', 'path': 'derp', 'file_name':'derp2.txt'}
data = {'username': 'admin', 'path': '', 'password': 'password', 'file_name': 'derp'}
response = requests.post("http://127.0.0.1:8000/add_dir/", data=data)
print response.text
# response = requests.post("http://127.0.0.1:8000/request/", data=data, headers=headers, files=files)