A simple model based API maker written in Python and based on Django and Django REST Framework

Overview

Fast DRF Documentation Status Python packaging

Fast DRF is a small library for making API faster with Django and Django REST Framework. It's easy and configurable.

Full Documentation here

Change Log is here

Features

  1. Runtime API creation without writing View, Serializer, Url, etc
  2. API versioning by default.
  3. Control fields on each versions
  4. An enhanced filtering support align with Django query filter.
  5. Customizable API URL and API Prefix.
  6. Options for Overriding Viewset, Serializer, Queryset
  7. Query optimization enabled for API with Django's prefetch_related and select_related 8 Full control over project during making automated API. i.e: you can select an Django app to enable for making API.

Quick Start

  • Install the library inside your virtualenv by using pip pip install fast-drf
  • Add config for Fast DRF like following,
FAST_DRF_CONFIG = {
    'DEFAULT_APPLIED_APPS': (
        'example_app', 'another_app'
    )
}
  • Update your every model or if you use base abstract model then it's good and less time you need. Update model like following,
from fast_drf.mixins.expose_api_model_mixin import ExposeApiModelMixin
from django.db import models


class MyModel(ExposeApiModelMixin, models.Model):
    #... All yor fields
    pass
    
    # The following methods are available from model mixin
    @classmethod
    def exposed_api(cls, *args, **kwargs):
        """
        This method holds a bunch of API configs and return like following...
        {
            "api_url": "",  # (REQUIRED)

            # You must use from HTTPVerbsEnum. Like HTTPVerbsEnum.GET.value, HTTPVerbsEnum.POST.value
            "allowed_methods": ['get', 'post', 'put', 'patch', 'delete'], # (NOT REQUIRED)

            # slug_field is application 'put', 'patch', 'delete' these methods
            "slug_field": "pk", # (NOT REQUIRED) DEFAULT [PK] (Must be model field, unique or primary key)

            "queryset": "",  # (NOT REQUIRED) default all
            "viewset_class": "",  # (NOT REQUIRED) BaseViewset class
            "serializer_class": "",  # (NOT REQUIRED) default BaseEntitySerializer
            "permission_classes": "",  # (NOT REQUIRED) default set from settings
        }
        :param args:
        :param kwargs:
        :return: An empty Dictionary/False OR Full config dictionary.
        """
        api_configs = {
            "api_url": 'my-model-api',
        }
        return api_configs

Enable multiple API version

To achieve this awesomeness rewrite the following method in your model

@classmethod
def api_version_fields(cls, **kwargs):
    """
    *** DEFAULT VERSION `v1` ***

    This method will return a dictionary object with version number and fields name. Fields are similar like
    serializer fields. Or you can say exactly as same as serializer fields.
    :param kwargs: Currently nothing to receive on kwargs
    :return: a dictionary object with version number
    """
    versions = {
        'v1': ['id', 'name', 'custom_1', 'custom_2'],
        'v2': ['id', 'name', 'something_else']
    }
    return versions

Append a slash at the end of of API

Set APPEND_SLASH = True at your settings.py

API Prefix Change

Set you API prefix as your own like following.

FAST_DRF_CONFIG = {
    # ...
    'DEFAULT_API_PREFIX': 'rest-api'  # Default 'api'
    # ...
}

Your API will look like, /rest-api/v1/users/

That's it. You can also override serializer class and viewset class

You might also like...
Authentication for Django Rest Framework

Dj-Rest-Auth Drop-in API endpoints for handling authentication securely in Django Rest Framework. Works especially well with SPAs (e.g React, Vue, Ang

JSON Web Token Authentication support for Django REST Framework

REST framework JWT Auth JSON Web Token Authentication support for Django REST Framework Overview This package provides JSON Web Token Authentication s

A JSON Web Token authentication plugin for the Django REST Framework.

Simple JWT Abstract Simple JWT is a JSON Web Token authentication plugin for the Django REST Framework. For full documentation, visit django-rest-fram

A JSON Web Token authentication plugin for the Django REST Framework.

Simple JWT Abstract Simple JWT is a JSON Web Token authentication plugin for the Django REST Framework. For full documentation, visit django-rest-fram

A full Rest-API With Oauth2 and JWT for request & response a JSON file Using FastAPI and SQLAlchemy 🔑
A full Rest-API With Oauth2 and JWT for request & response a JSON file Using FastAPI and SQLAlchemy 🔑

Pexon-Rest-API A full Rest-API for request & response a JSON file, Building a Simple WorkFlow that help you to Request a JSON File Format and Handling

Foundation Auth Proxy is an abstraction on  Foundations' authentication layer and is used to authenticate requests to Atlas's REST API.
Foundation Auth Proxy is an abstraction on Foundations' authentication layer and is used to authenticate requests to Atlas's REST API.

foundations-auth-proxy Setup By default the server runs on http://0.0.0.0:5558. This can be changed via the arguments. Arguments: '-H' or '--host': ho

This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST (JSON)

Welcome to django-rest-auth Repository is unmaintained at the moment (on pause). More info can be found on this issue page: https://github.com/Tivix/d

REST implementation of Django authentication system.
REST implementation of Django authentication system.

djoser REST implementation of Django authentication system. djoser library provides a set of Django Rest Framework views to handle basic actions such

Authentication Module for django rest auth

django-rest-knox Authentication Module for django rest auth Knox provides easy to use authentication for Django REST Framework The aim is to allow for

Comments
  • Detect default api_configs.api_url

    Detect default api_configs.api_url

    Currently it is mandatory to have the following on each model:

        @classmethod
        def exposed_api(cls, *args, **kwargs):
            api_configs = {
                "api_url": 'my-model-api',
            }
            return api_configs
    

    While most production sites will want to customise the urls, it is possible to derive a sensible default from the model class name, making it possible to add models to the API by only adding the mixin. Much faster. And even in production sites, there will be some parts of the API for which the default model name is an acceptable URI name, especially for smaller models.

    opened by jayvdb 6
  • v2.1.1 Release from latest changes

    v2.1.1 Release from latest changes

    2.1.1

    ADDED

    • Added test cases for test app
    • App directory structure has changed. But, no external effect.

    BUG FIXED

    • Import error and some other minor fixes
    opened by iashraful 0
  • Enable filtering with model fields

    Enable filtering with model fields

    Enable filtering with model fields

    Description Currently, We don't have any kind of search or filtering on API. So, We are going to work on it to achieve this feature.

    Tasks to do

    • For now just for model fields
    • Must have option to override on model
    feature 
    opened by iashraful 0
  • Bump djangorestframework from 3.9.0 to 3.9.1

    Bump djangorestframework from 3.9.0 to 3.9.1

    Bumps djangorestframework from 3.9.0 to 3.9.1.

    Release notes

    Sourced from djangorestframework's releases.

    Version 3.9.1

    Change Notes: https://www.django-rest-framework.org/community/release-notes/#39x-series

    Commits
    • 453196e Version 3.9.1 (#6405)
    • 4bb9a3c Fix XSS caused by disabled autoescaping in the default DRF Browsable API view...
    • e3bd4b9 Fix #1811: take limit_choices_to into account with FK (#6371)
    • 9c408b2 Remove reference to deprecated drf-openapi package (#6398)
    • e0ae975 Fix a badly formatted title in docs (#6089)
    • c052a86 compat: (py2) urlparse = urllib.parse (py3) (#6262)
    • a49d744 Fix OpenAPI links (#6382)
    • 0860ef9 Update quickstart to Django 2.0 routing syntax (#6385)
    • 587058e Allow run_validators() to handle non-dict types. (#6365)
    • 0cf18c4 Use Default Version in URLPathVersioning if 'version' Didn't Specified by Cli...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    dependencies 
    opened by dependabot[bot] 0
Releases(2.2.10)
  • 2.2.10(Apr 20, 2022)

  • 2.2.9(Mar 2, 2022)

  • 2.1.3(Apr 22, 2021)

  • 2.1.1(Mar 31, 2021)

    2.1.1

    ADDED

    • Added test cases for test app
    • App directory structure has changed. But, no external effect.

    BUG FIXED

    • Import error and some other minor fixes
    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Mar 20, 2021)

  • 2.0.0(Aug 12, 2020)

    2.0.0

    ADDED

    • Dynamic API filtering with model fields.
    • Support all the django filter on API params. Like: ?search=1&title:icontains=test

    UPDATED

    • Settings config data type updated with default configuration
    Source code(tar.gz)
    Source code(zip)
  • 1.0.10(Jul 19, 2020)

    1.0.10

    ADDED

    • Added Dockerfile and compose file for local dependency

    BUG FIXES

    • Django REST Framework six dependent version upgraded

    UPDATED

    • Updated API prefix and doc
    Source code(tar.gz)
    Source code(zip)
  • 1.0.9(Sep 27, 2019)

  • 1.0.6(Feb 26, 2019)

    UPDATED

    • Django version updated due to stop vulnerability warning

    ADDED

    • Create from two level of json according to API format

    BUG FIXED

    • Fixed permission class empty issue while user is not giving
    • Fixed Serializer list api data property calling issue
    Source code(tar.gz)
    Source code(zip)
  • 1.0.5(Jan 18, 2019)

  • 1.0.4(Jan 6, 2019)

  • 1.0.3(Jan 3, 2019)

    ADDED

    • Details API [PUT, PATCH, DELETE]
    • Allowed method choosing option
    • Only view class or only serializer class can override
    • Added support for view class or viewset or generic view

    UPDATED

    • Nothing

    BUG FIXED

    • Fixed queryset override issue
    • Fixed queryset caching issue
    Source code(tar.gz)
    Source code(zip)
  • 0.1.2(Dec 27, 2018)

  • 0.1.1(Dec 26, 2018)

    ADDED

    • Added utility classes for support
    • Added example app for local testing(Not added in package)

    UPDATED

    • Updated directory structure of app
    • Seperated mixins

    BUG FIXED

    • Fixed wrong queryset bug
    • Added loop iteration improvements
    Source code(tar.gz)
    Source code(zip)
  • 0.0.1(Dec 26, 2018)

    ADDED

    • Model Based api writing
    • Ability to override Serializer, View class, queryset
    • Work on proxy model

    BUG FIXED

    • Nothing as it's initial release
    Source code(tar.gz)
    Source code(zip)
Owner
Mohammad Ashraful Islam
*nix Fan, Open Source Contributor, Problem Solver, Python Lover, JS fan
Mohammad Ashraful Islam
A fully tested, abstract interface to creating OAuth clients and servers.

Note: This library implements OAuth 1.0 and not OAuth 2.0. Overview python-oauth2 is a python oauth library fully compatible with python versions: 2.6

Joe Stump 3k Jan 02, 2023
Ready to use and customizable Authentications and Authorisation management for FastAPI âš¡

AuthenticationX 💫 Ready-to-use and customizable Authentications and Oauth2 management for FastAPI ⚡ Source Code: https://github.com/yezz123/AuthX Doc

Yasser Tahiri 404 Dec 27, 2022
JWT authentication for Pyramid

JWT authentication for Pyramid This package implements an authentication policy for Pyramid that using JSON Web Tokens. This standard (RFC 7519) is of

Wichert Akkerman 73 Dec 03, 2021
Provide OAuth2 access to your app

django-oml Welcome to the documentation for django-oml! OML means Object Moderation Layer, the idea is to have a mixin model that allows you to modera

Caffeinehit 334 Jul 27, 2022
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic

OAuthLib - Python Framework for OAuth1 & OAuth2 *A generic, spec-compliant, thorough implementation of the OAuth request-signing logic for Python 3.5+

OAuthlib 2.5k Jan 02, 2023
Djagno grpc authentication service with jwt auth

Django gRPC authentication service STEP 1: Install packages pip install -r requirements.txt STEP 2: Make migrations and migrate python manage.py makem

Saeed Hassani Borzadaran 3 May 16, 2022
Python One-Time Password Library

PyOTP - The Python One-Time Password Library PyOTP is a Python library for generating and verifying one-time passwords. It can be used to implement tw

PyAuth 2.2k Dec 26, 2022
OAuthlib support for Python-Requests!

Requests-OAuthlib This project provides first-class OAuth library support for Requests. The OAuth 1 workflow OAuth 1 can seem overly complicated and i

1.6k Dec 28, 2022
examify-io is an online examination system that offers automatic grading , exam statistics , proctoring and programming tests , multiple user roles

examify-io is an online examination system that offers automatic grading , exam statistics , proctoring and programming tests , multiple user roles ( Examiner , Supervisor , Student )

Ameer Nasser 4 Oct 28, 2021
Crie seus tokens de autenticação com o AScrypt.

AScrypt tokens O AScrypt é uma forma de gerar tokens de autenticação para sua aplicação de forma rápida e segura. Todos os tokens que foram, mesmo que

Jaedson Silva 0 Jun 24, 2022
FastAPI extension that provides JWT Auth support (secure, easy to use, and lightweight)

FastAPI JWT Auth Documentation: https://indominusbyte.github.io/fastapi-jwt-auth Source Code: https://github.com/IndominusByte/fastapi-jwt-auth Featur

Nyoman Pradipta Dewantara 468 Jan 01, 2023
Simplifying third-party authentication for web applications.

Velruse is a set of authentication routines that provide a unified way to have a website user authenticate to a variety of different identity provider

Ben Bangert 253 Nov 14, 2022
Skit-auth - Authorization for skit.ai's platform

skit-auth This is a simple authentication library for Skit's platform. Provides

Skit 3 Jan 08, 2022
RSA Cryptography Authentication Proof-of-Concept

RSA Cryptography Authentication Proof-of-Concept This project was a request by Structured Programming lectures in Computer Science college. It runs wi

Dennys Marcos 1 Jan 22, 2022
Object Moderation Layer

django-oml Welcome to the documentation for django-oml! OML means Object Moderation Layer, the idea is to have a mixin model that allows you to modera

Angel Velásquez 12 Aug 22, 2019
Boilerplate/Starter Project for building RESTful APIs using Flask, SQLite, JWT authentication.

auth-phyton Boilerplate/Starter Project for building RESTful APIs using Flask, SQLite, JWT authentication. Setup Step #1 - Install dependencies $ pip

sandhika 0 Aug 03, 2022
Social auth made simple

Python Social Auth Python Social Auth is an easy-to-setup social authentication/registration mechanism with support for several frameworks and auth pr

Matías Aguirre 2.8k Dec 24, 2022
Authentication for Django Rest Framework

Dj-Rest-Auth Drop-in API endpoints for handling authentication securely in Django Rest Framework. Works especially well with SPAs (e.g React, Vue, Ang

Michael 1.1k Jan 03, 2023
Use this to create (admin) personal access token in gitlab database. Mainly used for automation.

gitlab-personal-access-token Ensure PAT is present in gitlab database. This tool is mainly used when you need to automate gitlab installation and conf

CINAQ Internet Technologies 1 Jan 30, 2022
A Python inplementation for OAuth2

OAuth2-Python Discord Inplementation for OAuth2 login systems. This is a simple Python 'app' made to inplement in your programs that require (shitty)

Prifixy 0 Jan 06, 2022