-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfileServer.py
More file actions
38 lines (26 loc) · 809 Bytes
/
fileServer.py
File metadata and controls
38 lines (26 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import PortManager
urls = ('/fileserver/(.*)/payload/(.*)','fileServer2',
'/fileserver/(.*)','fileServer')
class fileServer:
def GET(self,filePath):
if os.path.isfile(filePath):
with open(filePath,'r') as file:
return file.read()
else:
value = (os.path.isfile(filePath)) + "****" + filePath
return value
class fileServer2:
def POST(self,filePath,payload):
if os.path.isfile(filePath):
with open(filePath,'a') as file:
file.write(payload)
return 'Done'
if __name__=="__main__":
app = PortManager.changePort(urls,globals())
app.run(port=8080)
'''
shelf = shelve.open('word_list.dat')
shelf['foo'] = {'bar':1}
shelf.close()
'''