Saravanan666/pypi-org huggingface dataset:
Package: django-rest-localflavor
Country-specific serializers fields, to Django Rest FrameworkDocumentation (soon)The full documentation is athttps://django-rest-localflavor.readthedocs.org.QuickstartInstall django-rest-localflavor:pip install django-rest-localflavorThen use it in a project:INSTALLED_APPS = (
    # ...
    'rest_framework',
    'rest_localflavor',
)History1.2.3 (2016-04-07)Fix validator imports to Brazil serializers1.2.2 (2015-11-04)Fix bugs to upload on PyPI.1.2.1 (2015-11-03)Insert locale files to package and upload on PyPI.1.2 (2015-11-03)Create serializer helpers to Canada (Thanks Mattias Lindvall <@thnee>).1.1 (2015-10-28)Generate a*.pofiles to Portuguese Language.1.0 (2015-10-27)First release on PyPI.Create serializer helpers to Brazil.
Package: django-rest-magic
Django REST Framework MagicDjango REST Framework Magic (DRF Magic) is a Django application that builds off our all of my
personal best practices of boiler-plates of working with a RESTful Django application. It makes a
fair amount of subjective coding decisions, but I hope that others see the benefit and
ease-of-development that they provide.Read the Documentation:https://drf-magic.readthedocs.io/en/latest/
Package: django-rest-marshmallow
django-rest-marshmallowMarshmallow schemasfor Django REST framework.Overviewdjango-rest-marshmallowprovides an alternative serializer implementation to the built-in serializers, by using the pythonmarshmallowlibrary, but exposing the same API as REST framework'sSerializerclass.RequirementsPython (2.7, 3.5+)Django REST framework (3.8+)Marshmallow (2.15+ and 3.0.0b18+)InstallationInstall usingpip...$pipinstalldjango-rest-marshmallowUsageDefine your schemas as you would with marshmallow, but importing theSchemaclass fromrest_marshmallowinstead.fromrest_marshmallowimportSchema,fieldsclassCustomerSchema(Schema):name=fields.String()email=fields.Email()created_at=fields.DateTime()The Schema class has the same interface as a Django REST framework serializer, so you can use it in your generic views...classCustomerListView(generics.ListAPIView):queryset=Customer.objects.all()serializer_class=CustomerSchemaOr use the serializer API directly, for either serialization...serializer=CustomerSchema(queryset,many=True)returnResponse(serializer.data)Or for validation...serializer=CustomerSchema(data=request.data)serializer.is_valid(raise_exception=True)serializer.validated_dataInstance create and updateIf you want to supportserializer.save()you'll need to define the.create()and/or.update()methods explicitly.classCustomerSchema(Schema):name=fields.String()email=fields.Email()created_at=fields.DateTime()defcreate(self,validated_data):returnCustomer.objects.create(**validated_data)defupdate(self,instance,validated_data):forkey,valueinvalidated_data.items():setattr(instance,key,value)instance.save()returninstanceYou can now use.save()from your view code…serializer=CustomerSchema(data=request.data)serializer.is_valid(raise_exception=True)serializer.save()returnResponse(serializer.data,status=status.HTTP_201_CREATED)Or use the schema together with generic views that create or update instances...classCustomerListView(generics.ListCreateAPIView):queryset=Customer.objects.all()serializer_class=CustomerSchemaNote that you should always use thecreate()andupdate()methods instead of overriding themake_object()marshmallow method.Nested representationsFor nested representations, use marshmallow's standardNestedfield as usual.fromrest_marshmallowimportfields,SchemaclassArtistSchema(Schema):name=fields.String()classAlbumSchema(Schema):title=fields.String()release_date=fields.Date()artist=fields.Nested(ArtistSchema)Excluding fieldsThe marshmallowonlyandexcludearguments are also valid as serializer arguments:serializer=CustomerSchema(queryset,many=True,only=('name','email'))returnResponse(serializer.data)TestingInstall testing requirements.$pipinstall-rrequirements.txtRun with runtests.$./runtests.pyYou can also use the excellenttoxtesting tool to run the tests against all supported versions of Python and Django. Install tox globally, and then simply run:$toxDocumentationTo build the documentation, you'll need to installmkdocs.$pipinstallmkdocsTo preview the documentation:$mkdocsserve
Runningat:http://127.0.0.1:8000/To build the documentation:$mkdocsbuild
Package: django-rest-mediabrowser
Warning!!! Work in Progress! Not ready for production use at all yet.Django REST MediaBrowserClient Loves CMS and Seperate JS Frontend. Thus born Django REST MediaBrowser. It will allow user to:Upload Files and Images with ownership and share two-level mechanism(view and edit)Keep your files safe unless you're the owner, or shared with you or the file is published publicly (Thanks todjango-private-storage).A beautiful REST-API (of course based ondjango-rest-framewok) to use the whole system and build a media manager frontend on top of it.InstallationUsing pip:pipinstalldjango-rest-mediabrowserAdd this app and its dependencies inINSTALLED_APPS:INSTALLED_APPS=[# ...'rest_framework','taggit','taggit_serializer','private_storage','django_filters','rest_mediabrowser',#...]Addrest_mediabrowserurls in project'surls.py:urlpatterns=[#...path('mediabrowser/',include('rest_mediabrowser.urls')),]Migrate.TODOWrite tests.Write a more comprehensive TODO.Code vigorously for first stable release.
Package: django-rest-messaging
The project provides a Facebook-like messaging API for django rest framework.RequirementsPython (2.7, 3.3, 3.4)Django (1.6, 1.7, 1.8)Django REST Framework (2.4, 3.0, 3.1)InstallationInstall usingpip…$pipinstalldjango-rest-messagingExampleTODO: Write example.TestingInstall testing requirements.$pipinstall-rrequirements.txtRun with runtests.$./runtests.pyYou can also use the excellenttoxtesting tool to run the tests
against all supported versions of Python and Django. Install tox
globally, and then simply run:$toxDocumentationTo build the documentation, you’ll need to installmkdocs.$pipinstallmkdocsTo preview the documentation:$mkdocsserveRunningat:http://127.0.0.1:8000/To build the documentation:$mkdocsbuild
Package: django-rest-messaging-centrifugo
OverviewReal time messaging for Django Rest frameworkRequirementsPython (2.7, 3.3, 3.4)Django (1.6, 1.7, 1.8)Django REST Framework (2.4, 3.0, 3.1)InstallationInstall usingpip…$pipinstalldjango-rest-messaging-centrifugoExampleTODO: Write example.TestingInstall testing requirements.$pipinstall-rrequirements.txtRun with runtests.$./runtests.pyYou can also use the excellenttoxtesting tool to run the tests
against all supported versions of Python and Django. Install tox
globally, and then simply run:$toxDocumentationTo build the documentation, you’ll need to installmkdocs.$pipinstallmkdocsTo preview the documentation:$mkdocsserveRunningat:http://127.0.0.1:8000/To build the documentation:$mkdocsbuild
Package: django-rest-multiple-models
drf-multiple-models provides an easy view (and mixin) for serializing multiple models in a single view.  It is built on top of (and meant to be an extension for) Django Rest Framework.InstallationInstall the package from pip:pipinstalldjango-rest-multiple-modelsMake sure to add ‘drf_multiple_model’ to your INSTALLED_APPS:INSTALLED_APPS=(...'drf_multiple_model',)Then simply import the view into any views.py in which you’d want to use it:fromdrf_multiple_model.viewsimportMultipleModelAPIViewUsageDocumentation is on ReadTheDocs:https://django-rest-multiple-models.readthedocs.io/en/latest/
Package: django-resto
**WARNING: the architecture described below isn't a best practice anymore.***Get in touch if you're using it and would like to maintain it in the future!*Introduction============django-resto (REplicated STOrage) provides file storage backends that canstore files coming into a Django site on several servers in parallel, usingHTTP. ``HybridStorage`` and ``AsyncStorage`` will store the files locally onthe filesystem and remotely, while ``DistributedStorage`` will only store themremotely.This works for files uploaded by users through the admin or through customDjango forms, and also for files created by the application code, provided ituses the standard `storage API`_.django-resto is useful for sites deployed in a multi-server environment, inorder to accept uploaded files and have them available on all media serversfor subsequent web requests that could be routed to any machine.
Package: django-Rest-phonenumber-confirmation
django-Rest-phonenumber-confirmationA Django library for phone number confirmation with twilio with phone number validationQuickstartFor installing django-drf-auth, just run this command in your shellpip install django-Rest-phonenumber-confirmationsettingsINSTALLED_APPS = (
    # ...

    'rest_framework',
    'phonenumber_field',
    'phonenumber_confirmation',
)

UNIQUE_PHONE_NUMBER = True
PHONE_CONFIRMATION_EXPIRE_MINUTES = 15

PHONENUMBER_DEFAULT_REGION = "Your region code"
PHONENUMBER_DB_FORMAT = ( 'INTERNATIONAL' or 'NATIONAL' )

# YOUR TWILIO INFORMATION
TWILIO_ACCOUNT_SID = 'xxxxxxxxxxx'
TWILIO_AUTH_TOKEN = 'xxxxxxxxxxx'
TWILIO_FROM_NUMBER = 'xxxxxxxxxxx'Dont forget dopython manage.py migrateURLSurlpatterns = [
    # ...
    path('phone-confirm/api/', include('phonenumber_confirmation.urls')),
]API Endpoints:CREATE PHONE NUMBER AND SEND CONFIRMATIONMethod:POSTEndpoint:/phone-number/sent/Payload:{   "phone": "PHONE NUMBER" }CONFIRM PHON NUMBERMethod:POSTEndpoint:/phone-number/confirmation/Payload:{   "pin": "PIN" }RESEND CONFIRMATION TO PHON NUMBERMethod:POSTEndpoint:/resend/<int:phonenumber_id>/confirmation/Param : phonenumber_id = phone number object idPYPIPYPI
Package: django-rest-query
A rest query request args parser for django orm. like no-sql select style.(/?select=id,name,author{*}&id=gte.20&order=id.desc).Installingpip installdjango-rest-queryTestpython setup.py testUsageDjango orm must use project shell. so wo start demo project:django-admin startproject demoAdd Model:class School(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=100)

    class Meta:
        db_table = 'School'

    def __str__(self):
        return 'School: {}'.format(self.name)

class Author(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=50)
    age = models.IntegerField()
    school = models.ForeignKey(School)

    class Meta:
        db_table = 'Author'

    def __str__(self):
        return 'Author: {}'.format(self.name)

class Book(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=50)
    author = models.ForeignKey(Author)
    publisher = models.ForeignKey(Publisher)

    class Meta:
        db_table = 'Book'

    def __str__(self):
        return 'Book: {}'.format(self.name)Usage:python manage.py shell
>>> from django_rest_query import *
>>> from demo.models import Book, Author, School
>>> args = {
    'select': 'id,name,author{id,name,school{*}}',
    'id': 'gte.20',
    'author.id': 'in.10,20,30,40,50',
    'order': 'id.desc',
    'page': 1,
    'limit': 5
}
>>> builder = DjangoQueryBuilder(Book, args)
builder.select
['author__school__*', 'author__id', 'author__name', 'id', 'name']
>>> build.where
{'author__id__in': [10, 20, 30, 40, 50], 'id__gte': '20'}
>>> builder.order
['-id']
>>> builder.paginate
(1, 5)
{'start': 0, 'end': 5, 'limit': 5, 'page': 1}
>>> builder.build()
<QuerySet [Book: Python], [Book: Javascript]>LicenseMITContactsEmail:huiquanxiong@gmail.com
Package: django-rest-recaptcha
Django Rest reCAPTCHA================**Django Rest reCAPTCHA field to add google recaptcha in django-rest-framework**Requirements------------Tested with:* Python: 2.7, 3.5* Django: 1.8, 1.9, 1.10, 1.11Installation------------#. Install with ``pip install django-rest-recaptcha``.#. Add ``'recaptcha'`` to your ``INSTALLED_APPS`` setting.#. Register and obtain recaptcha keys here `https://www.google.com/recaptcha/admin`#. Add the obtained keys to settings(For testing and development you can leave it blank to usedefault test keys as mentioned here `https://developers.google.com/recaptcha/docs/faq`).For example:.. code-block:: pythonGR_CAPTCHA_SECRET_KEY = 'GoogleRecaptchaPrivateKey001'Usage-----#. Now you can import and use the recaptcha field in your serializer.For example:.. code-block:: pythonfrom rest_framework import serializersfrom recaptcha.fields import ReCaptchaFieldclass ExampleSerializer(serializers.Serializer):recaptcha = ReCaptchaField(write_only=True)...Unit Testing~~~~~~~~~~~~Django Rest reCAPTCHA uses an environment variable ``RECAPTCHA_TESTING`` whichhelps tests. This environment variable should be set to ``"True"`` in yourtesting environment and any value will be considered to be validated.Example:.. code-block:: pythonimport osos.environ['RECAPTCHA_TESTING'] = 'True'data = {'recaptcha': 'dummy value'}response = client.post('/my/api/endpoint/', data)assert response.status_code == 200The code above may vary according to your testing suite.
Package: django-rest-registration
Django REST RegistrationUser registration REST API, based on Django REST Framework.DocumentationFull documentation for the project is available athttps://django-rest-registration.readthedocs.io/.RequirementsDjango (2.0+, 3.0+, 4.0+) and Django-REST-Framework (3.3+)Python 3.5 or higher (no Python 2 support!)FeaturesSupported views:registration (sign-up) with verificationlogin/logout (sign-in), session- or token-baseduser profile (retrieving / updating)reset passwordchange passwordregister (change) e-mailViews are compatible withdjango-rest-swaggerViews can be authenticated via session or auth tokenModeless (uses the user defined bysettings.AUTH_USER_MODELand also usescryptographic signinginstead of profile models)Usespassword validationHeavily tested (Above 98% code coverage)Current limitationsSupports only one email per user (as model field)No JWT support (but you can use it along libraries likedjango-rest-framework-simplejwt)Installation & ConfigurationYou caninstallDjango REST Registration latest version via pip:pip install django-rest-registrationThen, you should add it to theINSTALLED_APPSso the app templates
for notification emails can be accessed:INSTALLED_APPS=(...'rest_registration',)After that, you can use the urls in your urlconfig, for instance:api_urlpatterns=[...path('accounts/',include('rest_registration.api.urls')),]urlpatterns=[...path('api/v1/',include(api_urlpatterns)),]You can configure Django REST Registration using theREST_REGISTRATIONsetting in your Django settings (similarly to Django REST Framework).Below is sample, minimal config you can provide in your django settings which will satisfy the system checks:REST_REGISTRATION={'REGISTER_VERIFICATION_ENABLED':False,'RESET_PASSWORD_VERIFICATION_ENABLED':False,'REGISTER_EMAIL_VERIFICATION_ENABLED':False,}However, the preferred base configuration would be:REST_REGISTRATION={'REGISTER_VERIFICATION_URL':'https://frontend-host/verify-user/','RESET_PASSWORD_VERIFICATION_URL':'https://frontend-host/reset-password/','REGISTER_EMAIL_VERIFICATION_URL':'https://frontend-host/verify-email/','VERIFICATION_FROM_EMAIL':'no-reply@example.com',}The frontend urls are not provided by the library but should be provided
by the user of the library, because Django REST Registration is frontend-agnostic.
The frontend urls will receive parameters as GET query and should pass
them to corresponding REST API views via HTTP POST request.In case when any verification is enabled (which is the default!),
your Django application needs to beproperly configured so it can send e-mails.You can read more about basic configurationhere.You can read more about detailed configurationhere.Configuration optionsYou can find allREST_REGISTRATIONconfiguration optionshere.ContributingIf you want to contribute, please refer to separate documentCONTRIBUTING.md.
Package: django-restricted-paths
Django Restricted PathsDescriptionRestricts access to specific urls to staff only by responding with a specific view or raising a 404.Installationpipinstalldjango-restricted-pathsUsagein settings.py:RESTRICTED_PATHS={"ENABLED":notDEBUG,"PATHS":("/admin",),"VIEW":"path.to.view.class.ViewClass",}MIDDLEWARE=(..."restricted_paths.middleware.RestrictedPathsMiddleware")
Package: django-restricted-sessions
Restricts Django sessions to IP and/or user agent.If the IP or user agent changes after creating the session, the a 400 response is given to the request, the session is
flushed (all session data deleted, new session created) and a warning is logged. The goal of this middleware is to
make it harder for an attacker to use a session ID they obtained. It does not make abuse of session IDs impossible.For compatibility with IPv6 privacy extensions, by default only the first 64 bits of an IPv6 address are checked.DocumentationThe full documentation is athttps://django-restricted-sessions.readthedocs.org.QuickstartInstall django-restricted-sessions:pip install django-restricted-sessionsThen add it to your middleware after SessionMiddleware:MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    'restrictedsessions.middleware.RestrictedSessionsMiddleware',
    ....
]If you useRESTRICTEDSESSIONS_AUTHED_ONLY, ensure this middleware is added afterAuthenticationMiddlewareso that therequest.useris present.History0.4.0 (2023-06-02)Updated Django support to only 3.2, 4.1 and 4.2 (thanks to @ronnievdc).Various other cleanups and documentation format fixes.0.3.0 (2019-12-03)Updated Django support to 1.11, 2.2 and 3.0.Fixed issues whenX_FORWARDED_FORcontains multiple addresses.0.2.0 (2017-04-06)For Django 1.10+ support, changed fromobjecttodjango.utils.deprecation.MiddlewareMixinAdded PyPI trove classifiers for Django versions and more Python versionsUpdatedtravis.ymlfor more Python versions0.1.4 (2016-07-02)Fixed an exception that could occur when non-utf8 bytes were included
in user agent strings.0.1.3.1 (2016-05-26)Version bump to avoid PyPI’s duplicate filename ban.0.1.3 (2016-05-26)Added support to redirect to known view, or use custom status code settings.Added support for ignoring unauthenticated sessions.Fixed short circuit when REMOTE_ADDR was unknown.Dropped support for older Python versions: now requires 2.7, 3.3 or newer,
with Django 1.8.0.1.2 (2014-03-20)Resolved exception being raised when session switches from IPv4 to IPv6Python 3.4 support0.1.1 (2014-02-18)Added missing netaddr requirement to setup.py.0.1.0 (2014-02-17)First release on PyPI.
Package: django-restrictip
django-restrictip=============An ip blocker by regexp and ip range for Django apps.Usage=====1. Place 'restrictip' in the INSTALLED_APPS tuple of your settings.py file like so:INSTALLED_APPS = (...'restrictip',...)2. Place 'restrictip.middleware.RescrictIpMiddleware' in the MIDDLEWARE_CLASSEStuple of your settings.py file like so:MIDDLEWARE_CLASSES = (...'restrictip.middleware.RescrictIpMiddleware',...)3. Create tables:$ python manage.py syncdb4. Edit rules in the Django admin
Package: django-restrictmethodorigin
=====DJANGO-RESTRICTMETHODORIGIN=====DJANGO-RESTRICTMETHODORIGIN is a simple Django app to bind origins with http methods.So that its possible to allow ony speicific origins to make speicific http requests like POST, GET, PUT etc.Quick start-----------1. Add "restrictmethodorigin" to your INSTALLED_APPS setting like this:INSTALLED_APPS = [...'restrictmethodorigin',]2. Add "OriginRestrictor" to your MIDDLEWARE like this:MIDDLEWARE = [...'restrictmethodorigin.base.OriginRestrictor']3. In settings.py create a dictionary METHOD_ORIGIN like this:METHOD_ORIGIN = { 'POST': ['127.0.0.1'],'PUT': ['127.0.0.1','127.0.0.2'] }
Package: djangorest-routes
🔐 AR as a ServiceAn authentication library strongly built in Python (Django and Django Rest Framework). It serves the purpose of quick bootstrapping a project's authentication infrastructure.AbstractA reliable and trustworthy authentication library made for anyone who's a tinkerer and wants to get their personal or professional project authentication infrastructure built in no time.RoutesHere are it's key features:registerlogin (jwt)login (refresh jwt)confirm otpresend otp codelogoutchange passwordreset password otp (otp)reset password otp confirm (otp)reset password otp complete (otp)suspend userRequirementsPython (3.6, 3.7, 3.8, 3.9, 3.10)Django (2.2, 3.0, 3.1, 3.2, 4.0)Quick StartInstall usingpip:pip install djangorest-routesAdd "djangorest_routes" to your INSTALLED_APPS setting:INSTALLED_APPS = [
        ...
        'rest_routes',
        'sotp',
    ]Set "rest_routes.User" to AUTH_USER_MODEL setting:AUTH_USER_MODEL = "rest_routes.User"Set the length of the OTP code in your project settings, default is6:OTP_LENGTH = 8Include the OTP salt key in your project settings, do not expose this salt key:SALT_KEY = "some-secured-salt-key-for-otp-hashing"Include the rest_routes URLs in your project urls.py:path('rest_routes/', include('rest_routes.urls')),Runpython manage.py migrateto create thedjangorest_routesmodels.Seedocumentationfor django-sotp.Start the development server and visithttp://127.0.0.1:8000/rest_routes/Documentation & SupportFull documentation for the project is available atdocs.You may also want to follow the author ontwitter.LicenseDisclaimer: Everything you see here is open and free to use as long as you comply with thelicense. There are no hidden charges. We promise to do our best to fix bugs and improve the code.GratitudeSpecial thanks goes to the beautiful brains of the below listed packages. From your works, I tinkered and came up with something that works best for me! I'll forever be grateful!djangodjangorestframeworkdjangorestframework-simplejwtdrf-yasgrest-api-payloaddjango-sotp
Package: django-rest-scaffold
Django REST ScaffoldSource:https://github.com/gregschmit/django-rest-scaffoldREST Scaffold is a Django app that provides a template tag helper for using
therest-scaffold.jslibrary.The Problem: AJAX is nice because if you have an API, then you don’t need separate
pages/views for listing, creating, and updating model instances. But writing custom AJAX
tables on the frontend can be time-consuming.The Solution: This app provides a template tag that usesrest-scaffold.jsto
quickly render “scaffolds”, which are tables that have controls which interact with your
API.How to Use$pipinstalldjango-rest-scaffoldIncluderest_scaffoldin yourINSTALLED_APPS.Build your API or create one usingAutoREST.Then, insert a scaffold using therest_scaffoldtemplate tag. At the top
you’ll need to load the template tag:{%loadrest_scaffold%}And then wherever you want in the HTML page, inject the scaffold:{%rest_scaffold'user'api_root='api'%}In the above example, you would see a scaffold for theUsermodel.ContributingOpen a pull request fixing a bug or implementing a feature if you want to
contribute. You must only contribute code that you have authored or otherwise
hold the copyright to, and you must make any contributions to this project
available under the MIT license.To collaborators: don’t push using the--forceoption.Dev QuickstartREST Scaffold comes with asettings.pyfile, technically making it a Django project
as well as a Django app. First clone, the repository into a location of your choosing:$gitclonehttps://github.com/gregschmit/django-rest-scaffoldThen you can go into thedjango-rest-scaffolddirectory, install the test
environment requirements, and then migrate and run the local development server:$cddjango-rest-scaffold$pipinstall-rrequirements-test.txt$pythonmanage.pymigrate$pythonmanage.pycreatesuperuser...$pythonmanage.pyrunserverThen you can see the api athttp://127.0.0.1:8000/api/, and you can see the example
scaffold page athttp://127.0.0.1:8000/example/.