Initial commit

This commit is contained in:
Kumi 2020-06-10 11:07:59 +02:00
commit 3860f0baf0
5 changed files with 79 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
build/
dist/
*.egg-info/

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
Copyright (c) 2020, Kumi Systems e.U.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0
README.md Normal file
View file

33
setup.py Normal file
View file

@ -0,0 +1,33 @@
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="two-factor-kumisms",
version="0.9",
author="Kumi Systems e.U.",
author_email="support@kumi.systems",
description="Provides Kumi SMS support for django-two-factor-auth",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://kumig.it/kumisystems/",
packages=setuptools.find_packages(),
classifiers=[
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 3.0",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content"
],
python_requires='>=3.6',
)

View file

@ -0,0 +1,22 @@
from django.conf import settings
from urllib.request import Request, urlopen
from urllib.parse import urlencode
class KumiSMS(object):
def __init__(self, key=None):
self.key = key or settings.KUMISMS_APIKEY
def make_call(self, device, token):
raise NotImplementedError("Kumi SMS does not support phone calls!")
def send_sms(self, device, token):
url = 'https://kumisms.com/api/v1/send/'
vars = {"key": self.key, "text": "Your login token is: " + token, "recipient": str(device.number)}
request = Request(url, urlencode(vars).encode())
urlopen(request)
def get_gateway_class(import_path):
return KumiSMS