Skip to main content

Package for GoSMSGE that helps you to send messages to your clients

Project description

GOSMS.GE Python SMS Send

Python client module to send SMS messages using GOSMS.GE SMS Gateway.

To use this library, you must have a valid account on

Please note SMS messages sent with this library will be deducted by your GOSMS.GE account credits.

For any questions, please contact:


Send a message with Classic type

from gosms import SMS

sms: SMS = SMS('api_key')

sms.send('995555555555', 'Hello!', 'GOSMS.GE')

Check status of message

from gosms import SMS

sms: SMS = SMS('api_key')


Check balance

from gosms.settings import GOSMS_SETTINGS
from gosms import sms

GOSMS_SETTINGS['api_key'] = 'your_api_key'


usage in Django

# django settings file

    # you should have valid API key given by
    'api_key': 'your_api_key',

    # if DEBUG is True it will be True but you can override it here
    'dev_mode': False,

    # choices: GOSMSClient, ConsoleClient;
    'client': 'gosms.sms.GOSMSClient'
from gosms import sms

def send_message_view(request):
    """ :returns {"code": string,"message": string,"message_id": number,"balance": number,"user": string} """
    return sms.send('995555555555', 'Hello!', 'GOSMS.GE')

def check_status_view(request):
    """ :returns { id: number,sender: string,receiver: string,message: string',message_id: string,amount: number,status: string } """
    return sms.status('message_id')

def check_balance_view(request):
    """ returns { balance: number, user: string } """
    return sms.balance()

You can use it anywhere

# user.managers
from django.contrib.auth.base_user import BaseUserManager

class UserManager(BaseUserManager):
    use_in_migrations = True

    def _create_user(self, phone_number, password, **extra_fields):
        Creates and saves a User with the given email and password.
        if not phone_number:
            raise ValueError('The given phone_number must be set')
        user = self.model(phone_number=phone_number, **extra_fields)
        return user

    def create_user(self, phone_number, password=None, **extra_fields):
        extra_fields.setdefault('is_superuser', False)
        return self._create_user(phone_number, password, **extra_fields)

    def create_superuser(self, phone_number, password, **extra_fields):
        extra_fields.setdefault('is_superuser', True)

        if extra_fields.get('is_superuser') is not True:
            raise ValueError('Superuser must have is_superuser=True.')

        return self._create_user(phone_number, password, **extra_fields)
# user.models
from django.db import models
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.base_user import AbstractBaseUser
from django.utils.translation import ugettext_lazy as _

from user.managers import UserManager

from gosms import sms

class User(AbstractBaseUser, PermissionsMixin):
    phone_number = models.CharField(_('Phone Number'), unique=True)
    is_active = models.BooleanField(_('Is Active'), default=False)
    objects = UserManager()

    USERNAME_FIELD = 'phone_number'

    def save(self, *args, **kwargs):
        super().save(*args, **kwargs)
        sms.send(self.phone_number, 'user created', 'GOSMS.GE')
from django.shortcuts import get_object_or_404, render

from user.models import User
from gosms import sms

def user_register(request):
    user = User(

def verify_user(request):
    """ verify otp method raises exception if details are incorrect """
    response_data = sms.verify_otp(

    user = get_object_or_404(
        User, phone_number=request.POST.get('phone_number')
    user.is_active = True
    return render(request, 'some_template', context=response_data)

More info

You can check out our website

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gosmsge-1.0.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

gosmsge-1.0.1-py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page