def loadmsg(request): user = request.POST["username"] passwd = request.POST["password"] user = authenticate(username=user, password=passwd) if user is None: return Response(status=401) text = request.POST["text"] sender = request.POST["from"] timestamp = request.POST["timestamp"] timestamp = datetime.fromtimestamp(float(timestamp)) transport = Message("http+sms") transport.incoming(sender, text, timestamp, True) return Response()
def handle(ident, text, time=None, name="script"): transport = Message(name) return transport.incoming(ident, text, time)