|
308
|
1 |
|
|
|
2 |
from twisted.python import log |
|
|
3 |
from twisted.web import resource |
|
|
4 |
|
|
|
5 |
from ..controller import cmtelecom |
|
|
6 |
|
|
|
7 |
class CMTelecom(resource.Resource): |
|
|
8 |
isLeaf = True |
|
|
9 |
def render_GET(self, request): |
|
|
10 |
args = request.args |
|
|
11 |
cmtelecom.addStatus(recipient=args['GSM'][0], exID=args["REFERENCE"][0], status=args["STATUS"][0], data=args) |
|
|
12 |
|
|
|
13 |
return "Nothing to see here." |
|
|
14 |
|
|
|
15 |
def appendResource(root): |
|
|
16 |
"""adding CMTelecom to root.""" |
|
|
17 |
root.putChild('cmtelecom', CMTelecom()) |
|
|
18 |
|
|
|
19 |
if __name__ == '__main__': |
|
|
20 |
from twisted.web import resource, server |
|
|
21 |
from twisted.internet import reactor |
|
|
22 |
|
|
|
23 |
root = resource.Resource() |
|
|
24 |
root = appendResource(root) |
|
|
25 |
reactor.listenTCP(7080, server.Site(root)) |
|
|
26 |
reactor.run() |