Beispiel #1
0
def sms_in(request):
    """
    sender - the number of the person sending the sms
    receiver - the number the sms was sent to
    msgdata - the message
    """
    sender = request.GET.get("sender", None)
    receiver = request.GET.get("receiver", None)
    msgdata = request.GET.get("msgdata", None)
    if sender is None or msgdata is None:
        return HttpResponse(status=400)
    else:
        cleaned_text = convert_raw_string(msgdata)
        incoming_sms(sender, cleaned_text, "SISLOG", raw_text=msgdata)
        return HttpResponse()
Beispiel #2
0
    def test_decode(self):
        raw_to_clean = {
            # basic character test
            u"associa\x09\x7bo": u"associa\u00e7\u00e3o",

            # extended character test
            u"a\x09\x1b\x75car": u"a\u00e7\u00facar",

            # no decode
            u"no decode needed": u"no decode needed",
        }
        for raw, expected in raw_to_clean.items():
            cleaned = convert_raw_string(raw)
            self.assertEqual(cleaned, expected)
            print("Cleaned text: %s" % cleaned)
Beispiel #3
0
def sms_in(request, backend_id=None):
    """
    sender - the number of the person sending the sms
    receiver - the number the sms was sent to
    msgdata - the message
    """
    sender = request.GET.get("sender", None)
    receiver = request.GET.get("receiver", None)
    msgdata = request.GET.get("msgdata", None)
    if sender is None or msgdata is None:
        return HttpResponse(status=400)
    else:
        cleaned_text = convert_raw_string(msgdata)
        incoming_sms(sender, cleaned_text, SQLSislogBackend.get_api_id(), raw_text=msgdata, backend_id=backend_id)
        return HttpResponse()
Beispiel #4
0
    def test_decode(self):
        raw_to_clean = {
            # basic character test
            u"associa\x09\x7bo": u"associa\u00e7\u00e3o",

            # extended character test
            u"a\x09\x1b\x75car": u"a\u00e7\u00facar",

            # no decode
            u"no decode needed": u"no decode needed",
        }
        for raw, expected in raw_to_clean.items():
            cleaned = convert_raw_string(raw)
            self.assertEqual(cleaned, expected)
            print "Cleaned text: %s" % cleaned
Beispiel #5
0
def sms_in(request):
    """
    sender - the number of the person sending the sms
    receiver - the number the sms was sent to
    msgdata - the message
    """
    sender = request.GET.get("sender", None)
    receiver = request.GET.get("receiver", None)
    msgdata = request.GET.get("msgdata", None)
    if sender is None or msgdata is None:
        return HttpResponse(status=400)
    else:
        cleaned_text = convert_raw_string(msgdata)
        incoming_sms(sender, cleaned_text, "SISLOG", raw_text=msgdata)
        return HttpResponse()
Beispiel #6
0
def sms_in(request, backend_id=None):
    """
    sender - the number of the person sending the sms
    receiver - the number the sms was sent to
    msgdata - the message
    """
    sender = request.GET.get("sender", None)
    receiver = request.GET.get("receiver", None)
    msgdata = request.GET.get("msgdata", None)
    if sender is None or msgdata is None:
        return HttpResponse(status=400)
    else:
        cleaned_text = convert_raw_string(msgdata)
        incoming_sms(sender,
                     cleaned_text,
                     SQLSislogBackend.get_api_id(),
                     raw_text=msgdata,
                     backend_id=backend_id)
        return HttpResponse()