-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasftp-server.run.py
executable file
·62 lines (52 loc) · 1.2 KB
/
asftp-server.run.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/python3
from eve import Eve
from eve.auth import BasicAuth
class MyBasicAuth(BasicAuth):
def check_auth(self, username, password, allowed_roles, resource, method):
return username == 'admin' and password == 'secret'
schema_info = {
'name': {
'type': 'string',
},
'status' : {
'type' : 'string',
},
}
schema_data = {
'data1': {
'type': 'string',
'minlength': 1,
'maxlength': 10,
'required': True,
},
'data2': {
'type': 'string',
'minlength': 0,
'maxlength': 10,
},
}
my_settings = {
'MONGO_HOST': 'localhost',
'MONGO_PORT': 27017,
'MONGO_DBNAME': 'as_ftp',
'RESOURCE_METHODS' : ['GET', 'POST'],
'ITEM_METHODS' : ['GET', 'PATCH', 'PUT', 'DELETE'],
'DOMAIN': {
'ftp_server_info': {
'schema' : schema_info
},
'ftp_data': {
'authentication': MyBasicAuth,
'schema' : schema_data
},
'ftp_action': {
'authentication': MyBasicAuth
},
'ASftp_data': {
'authentication': MyBasicAuth
}
}
}
app = Eve(settings=my_settings)
if __name__ == '__main__':
app.run('',5000)