<commit_before># -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.utils.http import urlencode

from smsgateway.backends.base import SMSBackend

class SpryngBackend(SMSBackend):
    def get_send_url(self, sms_request, account_dict):
        # Encode message
        msg = sms_request.msg
        msg = msg.replace(u'€', unichr(128))
        try:
            msg = msg.encode('iso-8859-15')
        except:
            pass

        querystring = urlencode({
            'REFERENCE': sms_request.reference or '',
            'USERNAME': account_dict['username'],
            'PASSWORD': account_dict['password'],
            'DESTINATION': ','.join([x[1:] for x in sms_request.to]),
            'SENDER': sms_request.signature,
            'BODY': msg,
            'SERVICE': 'smsgateway',
            'ROUTE': account_dict.get('SMSTYPE', 'BUSINESS'),
            'ALLOWLONG': '0',
        })
        return 'https://www.spryng.nl/send.php?%s' % querystring

    def get_slug(self):
        return 'spryng'

    def handle_incoming(self, request, reply_using=None):
        return HttpResponse('')

    def get_url_capacity(self):
        return 1

    def validate_send_result(self, result):
        return result == u'1'<commit_msg>fix spryng backend<commit_after># -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.utils.http import urlencode

from smsgateway.backends.base import SMSBackend

class SpryngBackend(SMSBackend):
    def get_send_url(self, sms_request, account_dict):
        # Encode message
        msg = sms_request.msg
        msg = msg.replace(u'€', unichr(128))
        try:
            msg = msg.encode('iso-8859-15')
        except:
            pass

        if isinstance(sms_request.to, basestring):
            sms_request.to = [ sms_request.to ]

        querystring = urlencode({
            'REFERENCE': sms_request.reference or '',
            'USERNAME': account_dict['username'],
            'PASSWORD': account_dict['password'],
            'DESTINATION': ','.join(sms_request.to),
            'SENDER': sms_request.signature,
            'BODY': msg,
            'SERVICE': 'smsgateway',
            'ROUTE': account_dict.get('SMSTYPE', 'BUSINESS'),
            'ALLOWLONG': '0',
        })
        return 'https://www.spryng.nl/send.php?%s' % querystring

    def get_slug(self):
        return 'spryng'

    def handle_incoming(self, request, reply_using=None):
        return HttpResponse('')

    def get_url_capacity(self):
        return 1

    def validate_send_result(self, result):
        return result == u'1'
{'fraction_non_alphanumeric': 0.12750385208012327, 'fraction_numerical': 0.010400616332819723, 'mean_word_length': 2.3423423423423424, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '335868', 'n_tokens_mistral': 833, 'n_tokens_neox': 808, 'n_words': 166}