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
Complete Two-Factor Authentication for Django providing the easiest integration into most Django projects.

Django Two-Factor Authentication Complete Two-Factor Authentication for Django. Built on top of the one-time password framework django-otp and Django'

Bouke Haarsma 1.3k Jan 04, 2023
it's a Django application to register and authenticate users using phone number.

django-phone-auth It's a Django application to register and authenticate users using phone number. CustomUser model created using AbstractUser class.

MsudD 4 Nov 29, 2022
Brute force a JWT token. Script uses multithreading.

JWT BF Brute force a JWT token. Script uses multithreading. Tested on Kali Linux v2021.4 (64-bit). Made for educational purposes. I hope it will help!

Ivan Å incek 5 Dec 02, 2022
Imia is an authentication library for Starlette and FastAPI (python 3.8+).

Imia Imia (belarussian for "a name") is an authentication library for Starlette and FastAPI (python 3.8+). Production status The library is considered

Alex Oleshkevich 91 Nov 24, 2022
CheckList-Api - Created with django rest framework and JWT(Json Web Tokens for Authentication)

CheckList Api created with django rest framework and JWT(Json Web Tokens for Aut

shantanu nimkar 1 Jan 24, 2022
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
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
OAuth2 goodies for the Djangonauts!

Django OAuth Toolkit OAuth2 goodies for the Djangonauts! If you are facing one or more of the following: Your Django app exposes a web API you want to

Jazzband 2.7k Dec 31, 2022
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
An extension of django rest framework, providing a configurable password reset strategy

Django Rest Password Reset This python package provides a simple password reset strategy for django rest framework, where users can request password r

Anexia 363 Dec 24, 2022
OpenStack Keystone auth plugin for HTTPie

httpie-keystone-auth OpenStack Keystone auth plugin for HTTPie. Installation $ pip install --upgrade httpie-keystone-auth You should now see keystone

Pavlo Shchelokovskyy 1 Oct 20, 2021
A module making it easier to manage Discord oAuth with Quart

quart_discord A module making it easier to manage Discord oAuth with Quart Install pip install git+https://github.com/xelA/ 5 Oct 27, 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
Python library for generating a Mastercard API compliant OAuth signature.

oauth1-signer-python Table of Contents Overview Compatibility References Usage Prerequisites Adding the Library to Your Project Importing the Code Loa

23 Aug 01, 2022
Local server that gives you your OAuth 2.0 tokens needed to interact with the Conta Azul's API

What's this? This is a django project meant to be run locally that gives you your OAuth 2.0 tokens needed to interact with Conta Azul's API Prerequisi

FƔbio David Freitas 3 Apr 13, 2022
Strong, Simple, and Precise security for Flask APIs (using jwt)

flask-praetorian Strong, Simple, and Precise security for Flask APIs API security should be strong, simple, and precise like a Roman Legionary. This p

Tucker Beck 321 Dec 18, 2022
Per object permissions for Django

django-guardian django-guardian is an implementation of per object permissions [1] on top of Django's authorization backend Documentation Online docum

3.3k Jan 01, 2023
OAuth2 goodies for the Djangonauts!

Django OAuth Toolkit OAuth2 goodies for the Djangonauts! If you are facing one or more of the following: Your Django app exposes a web API you want to

Jazzband 2.7k Jan 01, 2023
A Python tool to generate and refresh Amazon access tokens.

amazon_auth A Python tool to generate and refresh Amazon access tokens. Description This tool generates and outputs Amazon access and refresh tokens f

15 Nov 21, 2022
Django x Elasticsearch Templates

Django x Elasticsearch Requirements Python 3.7 Django = 3 Elasticsearch 7.15 Setup Elasticsearch Install via brew Install brew tap elastic/tap brew

Aji Pratama 0 May 22, 2022