Flask directory upload POC, embed datasheet.info in html comment for parser reuse

This commit is contained in:
Jesse Cirimelli-Low
2018-11-13 17:29:43 -08:00
parent 0dd97e54dd
commit fa27d647d2
5 changed files with 62 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import requests
import os
import sys
# TODO
# copy directory structure
# relative links to not break dataseets?
# look into proper string and packet sanitization
# index gui + results graphs
base_url = 'http://localhost:5000/'
upload_url = 'upload'
def send_file(path):
upload_file = open(path,'rb')
data = {'file' : upload_file}
return requests.post(url = base_url + upload_url, files = data)
def send_mkdir(path):
def send_directory(path):
for root, directories, filenames in os.walk(path):
for filename in filenames:
upload_file = os.path.join(root,filename)
print(upload_file)
print(send_file(upload_file))
send_directory(sys.argv[1])
+1
View File
@@ -0,0 +1 @@
test