kwikapi.django
Quickly build API services to expose functionality in Python. kwikapi.django was built by using the functionality of KwikAPI and Django web server.
Installation
$ pip3 install kwikapi[django]
Usage
Create a Django project
(Ref: https://docs.djangoproject.com/en/1.11/intro/tutorial01/)
$ django-admin startproject django_kwikapi
Create an app in Django
$ python3 manage.py startapp polls
Add your app name to settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'polls',
]
Make sure the contents of files be like this
/django_kwikapi/django_kwikapi/urls.py
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('polls.urls'))
]
/django_kwikapi/polls/urls.py
from django.conf.urls import url, include
from . import views
from kwikapi.django import RequestHandler
urlpatterns = [
url(r'api/', RequestHandler(views.api).handle_request),
]
Example of django views
/django_kwikapi/polls/views.py
from django.http import HttpResponse
from kwikapi import API
from logging import Logger
class BaseCalc():
def add(self, a: int, b: int) -> int:
return a + b
def subtract(self, a: int, b: int) -> int:
return a - b
class StandardCalc():
def multiply(self, a: int, b: int) -> int:
return a * b
def divide(self, a: int, b: int) -> float:
return a / b
api = API(log=Logger, default_version='v1')
api.register(BaseCalc(), 'v1')
api.register(StandardCalc(), "v2")
Start Django
$ python3 manage.py makemigrations
$ python3 manage.py migrate
$ python3 manage.py runserver 8888
Make API request
$ curl "http://localhost:8888/api/v1/add?a=10&b=10"
To know how to use all features, please refer KwikAPI documentation https://github.com/deep-compute/kwikapi/blob/master/README.md
Metadata
Release files for kwikapi-django 0.2.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kwikapi-django-0.2.8.tar.gz | 3.4 kB | Without provenance | Details for kwikapi-django-0.2.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kwikapi_django-0.2.8-py3-none-any.whl | Python 3 | none | any | Details for kwikapi_django-0.2.8-py3-none-any.whl |
Total release size: 7.8 kB
Release files / kwikapi-django-0.2.8.tar.gz
| Download URL | kwikapi-django-0.2.8.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
416f29a84469f68d8384a27cb41cfdb55c79deac0f3c5de71718359569750a21
|
|
BLAKE2b-256 checksum How to use checksums |
26cf52a56238213f8158e853e713236765393b38a85b316855a7f69a08880b7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.6
|
Release files / kwikapi_django-0.2.8-py3-none-any.whl
| Download URL | kwikapi_django-0.2.8-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
507b2d1a48f06ce06080e81e4c2e5e46d47dfaeff53b5d92a3f376e0e62f2175
|
|
BLAKE2b-256 checksum How to use checksums |
5dd38e177acd7aff58b42531c0d54323e14279ff97f89fae86cb02171212c8c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.6
|
Security for kwikapi-django 0.2.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.