import requests
from requests.exceptions import Timeout, ConnectionError
from .url_shortener import url_shortener


class SMS(object):
    key = None
    url = None
    headers = {'content-type': 'application/json'}

    def __init__(self, app=None):
        if app is not None:
            self.init_app(app)

    def init_app(self, app=None):
        self.key = app.config.get('MSG91_KEY', None)
        self.url = app.config.get('MSG91_URL', None)

    @staticmethod
    def sms_short_link_generator(link):
        return url_shortener.get_short_url(link)

    def send_sms(self, sender='PAYNUD', route=4, country=91, key=None,
        content: str=None):
        try:
            response = requests.post(self.url, json=dict(sender=sender,
                route=route, country=country, sms=content), headers={
                'content-type': 'application/json', 'authkey': key or self.
                key}, timeout=5)
        except (Timeout, ConnectionError) as e:
            print(e)
            raise e
        return response


sms = SMS()

ed0f3610dcfe6a57b977a8b4336d3f7211ae3627
<mask token>


class SMS(object):
    <mask token>
    <mask token>
    <mask token>

    def __init__(self, app=None):
        if app is not None:
            self.init_app(app)

    def init_app(self, app=None):
        self.key = app.config.get('MSG91_KEY', None)
        self.url = app.config.get('MSG91_URL', None)

    @staticmethod
    def sms_short_link_generator(link):
        return url_shortener.get_short_url(link)
    <mask token>


<mask token>

<mask token>


class SMS(object):
    <mask token>
    <mask token>
    <mask token>

    def __init__(self, app=None):
        if app is not None:
            self.init_app(app)

    def init_app(self, app=None):
        self.key = app.config.get('MSG91_KEY', None)
        self.url = app.config.get('MSG91_URL', None)

    @staticmethod
    def sms_short_link_generator(link):
        return url_shortener.get_short_url(link)

    def send_sms(self, sender='PAYNUD', route=4, country=91, key=None,
        content: str=None):
        try:
            response = requests.post(self.url, json=dict(sender=sender,
                route=route, country=country, sms=content), headers={
                'content-type': 'application/json', 'authkey': key or self.
                key}, timeout=5)
        except (Timeout, ConnectionError) as e:
            print(e)
            raise e
        return response


<mask token>

<mask token>


class SMS(object):
    key = None
    url = None
    headers = {'content-type': 'application/json'}

    def __init__(self, app=None):
        if app is not None:
            self.init_app(app)

    def init_app(self, app=None):
        self.key = app.config.get('MSG91_KEY', None)
        self.url = app.config.get('MSG91_URL', None)

    @staticmethod
    def sms_short_link_generator(link):
        return url_shortener.get_short_url(link)

    def send_sms(self, sender='PAYNUD', route=4, country=91, key=None,
        content: str=None):
        try:
            response = requests.post(self.url, json=dict(sender=sender,
                route=route, country=country, sms=content), headers={
                'content-type': 'application/json', 'authkey': key or self.
                key}, timeout=5)
        except (Timeout, ConnectionError) as e:
            print(e)
            raise e
        return response


<mask token>

import requests
from requests.exceptions import Timeout, ConnectionError
from .url_shortener import url_shortener


class SMS(object):
    key = None
    url = None
    headers = {'content-type': 'application/json'}

    def __init__(self, app=None):
        if app is not None:
            self.init_app(app)

    def init_app(self, app=None):
        self.key = app.config.get('MSG91_KEY', None)
        self.url = app.config.get('MSG91_URL', None)

    @staticmethod
    def sms_short_link_generator(link):
        return url_shortener.get_short_url(link)

    def send_sms(self, sender='PAYNUD', route=4, country=91, key=None,
        content: str=None):
        try:
            response = requests.post(self.url, json=dict(sender=sender,
                route=route, country=country, sms=content), headers={
                'content-type': 'application/json', 'authkey': key or self.
                key}, timeout=5)
        except (Timeout, ConnectionError) as e:
            print(e)
            raise e
        return response


sms = SMS()
