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
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
Python module for generating and verifying JSON Web Tokens

python-jwt Module for generating and verifying JSON Web Tokens. Note: From version 2.0.1 the namespace has changed from jwt to python_jwt, in order to

David Halls 210 Dec 24, 2022
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

James McMahon 878 Jan 04, 2023
JWT Key Confusion PoC (CVE-2015-9235) Written for the Hack the Box challenge - Under Construction

JWT Key Confusion PoC (CVE-2015-9235) Written for the Hack the Box challenge - Under Construction This script performs a Java Web Token Key Confusion

Alex Fronteddu 1 Jan 13, 2022
Login System Using Django

Login System Django

Nandini Chhajed 6 Dec 12, 2021
Generate payloads that force authentication against an attacker machine

Hashgrab Generates scf, url & lnk payloads to put onto a smb share. These force authentication to an attacker machine in order to grab hashes (for exa

xct 35 Dec 20, 2022
Multi-user accounts for Django projects

django-organizations Summary Groups and multi-user account management Author Ben Lopatin (http://benlopatin.com) Status Separate individual user ident

Ben Lopatin 1.1k Jan 02, 2023
A host-guest based app in which host can CREATE the room. and guest can join room with room code and vote for song to skip. User is authenticated using Spotify API

A host-guest based app in which host can CREATE the room. and guest can join room with room code and vote for song to skip. User is authenticated using Spotify API

Aman Raj 5 May 10, 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
Login qr line & qr image

login-qr-line-qr-image login qr line & qr image python3 & linux ubuntu api source: https://github.com/hert0t/BEAPI-BETA import httpx import qrcode fro

Alif Budiman 1 Dec 27, 2021
PetitPotam - Coerce NTLM authentication from Windows hosts

Python implementation for PetitPotam

ollypwn 137 Dec 28, 2022
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
Get inside your stronghold and make all your Django views default login_required

Stronghold Get inside your stronghold and make all your Django views default login_required Stronghold is a very small and easy to use django app that

Mike Grouchy 384 Nov 23, 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
Script that provides your TESLA access_token and refresh_token

TESLA tokens This script helps you get your TESLA access_token and refresh_token in order to connect to third party applications (Teslamate, TeslaFi,

Bun-Ny TAN 3 Apr 28, 2022
Basic auth for Django.

easy-basicauth WARNING! THIS LIBRARY IS IN PROGRESS! ANYTHING CAN CHANGE AT ANY MOMENT WITHOUT ANY NOTICE! Installation pip install easy-basicauth Usa

bichanna 2 Mar 25, 2022
Django Rest Framework App wih JWT Authentication and other DRF stuff

Django Queries App with JWT authentication, Class Based Views, Serializers, Swagger UI, CI/CD and other cool DRF stuff API Documentaion /swagger - Swa

Rafael Salimov 4 Jan 29, 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
Todo app with authentication system.

todo list web app with authentication system. User can register, login, logout. User can login and create, delete, update task Home Page here you will

Anurag verma 3 Aug 18, 2022
python-social-auth and oauth2 support for django-rest-framework

Django REST Framework Social OAuth2 This module provides OAuth2 social authentication support for applications in Django REST Framework. The aim of th

1k Dec 22, 2022