Skip to main content

Restful API view utils.

Project description

django-apiview

Restful API view utils.

Install

pip install django-apiview

Settings

INSTALLED_APPS = [
    ......
    'apiview',
    ......
]

Example

import time
from apiview.views import apiview

@apiview
def ping():
    return "pong"

@apiview
def timestamp():
    return int(time.time())

@apiview
def echo(msg: str):
    return msg

@apiview
def getBooleanResult(value : bool):
    return value

@apiview
def getIntegerResult(value: int):
    return value

@apiview
def getBytesResult(value: bytes):
    return value

@apiview
def getException():
    raise RuntimeError("this is an example error")

Releases

v0.2.0

  • Using fastutils.typingutils for annotation cast.
  • Add result pack mechanism.
  • Move example views from the main app to example app and the example app is not include in published package.

v0.1.3

  • Add logging while getting result failed in @apiview.
  • Add Map, List annotations.

v0.1.2

  • Fix form process problem.

v0.1.1

  • Add PAYLOAD injection, PAYLOAD field has low priority.

v0.1.0

  • First release,

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

django-apiview-0.2.0.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file django-apiview-0.2.0.tar.gz.

File metadata

  • Download URL: django-apiview-0.2.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for django-apiview-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f257a0c69986dd1e9334026d9d38df36a9ede0d45c15d07271362ae440c052dd
MD5 2e6752d34b01d2db01dcd56a7004c1d3
BLAKE2b-256 a90ec7bc0fefa120beb649905138865ad740c80b7e56ee3a57d05e57c77c34fd

See more details on using hashes here.

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