Saravanan666/pypi-org huggingface dataset:
Package: django-rest-error
Django Error Codes is a Django app to manage the error in your api. For each error,
you can have a description and code.Detailed documentation is in the “docs” directory.Quick startInstall dependencies:pip install  djangorestframeworkAdd “error_codes” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'rest_framework',
    'error_codes',
]Include the errors docs URLconf in your project urls.py like this:path('error/', include('error_codes.urls')),Runpython manage.py migrateto create the polls models.Start the development server and visithttp://127.0.0.1:8000/admin/to create a errors (you’ll need the Admin app enabled).Visithttp://127.0.0.1:8000/error/docs/to see all errors if you have errors saved in the database.
Package: django-rest-exception-handler
Django REST Framework Exception HandlerThe Django REST Framework Exception Handler is a Python package designed to streamline exception handling within Django REST Framework applications. It ensures a consistent format for error responses by structuring them in a predefined JSON format.
InstallationYou can install the package via pip:pipinstalldjango-rest-exception-handlerUsageInstallation: After installation, include the package in your Django REST Framework settings insettings.py.REST_FRAMEWORK={# Other settings...'EXCEPTION_HANDLER':'django_rest_exception_handler.exception_handlers.exception_handler'}Response Format: The package handles exceptions and formats the response in the following structure:{"status":false,"message":"fail","error":"specific error message here"}With using this package you could raise an excetion anywhere inside your application. Exceptions other than the APIException class will be raised as 500 Internal server error exception by the exception handler.Example:
Here the exception handler will raise a 400 exception if the data passed by the request to the serializer is invalid.# Your Django view codefromrest_framework.viewsimportAPIViewfromrest_framework.responseimportResponsefromrest_framework.requestimportRequestfrom.serializersimportYourSerializerclassYourView(APIView):defpost(self,request:Request)->Response:serializer=YourSerializer(data=request.data)serializer.is_valid(raise_exception=True)serializer.save()returnResponse(serializer.data)ContributingWe welcome contributions! Feel free to open issues or submit pull requests.
LicenseThis project is licensed under the MIT License - see the LICENSE file for details.
Package: django-rest-extensions
django-rest-extensionsA project that can provide api super super super fast.WARNINGThis app will expose all api to the public make sure you have added the correct permission rulesTODOadd configurations parameters that allow user to limit which apps or models should generate apiInstallpip install django-rest-extensionsUsage1. add rest_extensions to INSTALLED_APPS
INSTALLED_APPS = [
    ...
    "rest_extensions",
]
2. add url to project.urls
urlpatterns = [
    path('rest_extensions/', include("rest_extensions.urls")),
]Examplecd example
python manage.py runserver
Package: django-rest-firebase-auth
Django Rest Firebase AuthUse firebase authentication with your django rest framework projectRequirementsPython (3.5, 3.6, 3.7 or 3.8)Django >= 2.2Django Rest FrameworkInstallationpip install django-rest-firebase-authOn your project'ssettings.pyadd this to theREST_FRAMEWORKconfigurationREST_FRAMEWORK = {
    ...
    "DEFAULT_AUTHENTICATION_CLASSES": [
        "firebase_auth.authentication.FirebaseAuthentication"
    ]
    ...
}Get your admin credentials.jsonfrom the Firebase SDK and add them to your projectFIREBASE_AUTH = {
    "SERVICE_ACCOUNT_KEY_FILE" = "path_to_your_credentials.json"
}Thedjango-rest-firebase-authcomes with the following settings as default, which can be overridden in your project'ssettings.py.FIREBASE_AUTH = {
    "SERVICE_ACCOUNT_KEY_FILE": "",

    # require that user has verified their email
    "EMAIL_VERIFICATION": False
}
Package: django-restframework-2fa
DRF Two Factor Authentication.A simple two factor authentication plugin forDjango Rest Frameworkbuilt on top ofSimple JWTand compatible with Twilio's SMS service.The motive ofDRF Two Factor Authenticationis to provide the pre defined basic authentication related APIs. It aims to cover the most common use case ofTwo Factor Authenticationby providing the set of most generic APIs. This plugin will only work with Twilio's SMS service.AcknowledgmentsIt is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).ContentRequirementsInstallationUsageRequirementsPython (3.7, 3.8, 3.9)Django (3.2.4)Django Rest Framework (3.12.4)Django Rest Framework Simple JWT (4.6.0)Twilio (6.55.0)InstallationDRF Two Factor Authentication can be installed with pip:pip install django-restframework-2faIt is required to have your Django project configured to use the pluginSimple JWT. It is highly recommended to appropriately configure this plugin as this package is highly dependent on it.
Package: djangorestframework-admin
djangorestframework-admin介绍基于DjangoRestframework开发的后台管理软件架构软件架构说明安装教程xxxxxxxxxxxx使用说明xxxxxxxxxxxx参与贡献Fork 本仓库新建 Feat_xxx 分支提交代码新建 Pull Request特技使用 Readme_XXX.md 来支持不同的语言，例如 Readme_en.md, Readme_zh.mdGitee 官方博客blog.gitee.com你可以https://gitee.com/explore这个地址来了解 Gitee 上的优秀开源项目GVP全称是 Gitee 最有价值开源项目，是综合评定出的优秀开源项目Gitee 官方提供的使用手册https://gitee.com/helpGitee 封面人物是一档用来展示 Gitee 会员风采的栏目https://gitee.com/gitee-stars/
Package: django-rest-framework-angular-resource-generator
Command for django that generates AngularJS services, compatible with ngResource.$resource, that provide client-side representation of the models and remote methods in angular-application. For more info:https://github.com/gerasev-kirill/django-rest-framework-angular-resource-generatorQuick startinstall using pip:pipinstalldjango-rest-framework-angular-resource-generatoradd “drf_ng_generator” to your INSTALLED_APPS setting like this:INSTALLED_APPS=(...'drf_ng_generator')run next command to create ngResource-file from drf views:python./manage.pydrf_ng./path-to-my-static-dir/resources.jsor (to generate the coffee-script file):python./manage.pydrf_ng./path-to-my-static-dir/resources.coffeeFor more info:https://github.com/gerasev-kirill/django-rest-framework-angular-resource-generator
Package: djangorestframework-api-gateway-auth
Installationpip install djangorestframework-api-gateway-authOr with poetrypoetry add djangorestframework-api-gateway-authUsageBasicApiGatewayApiKeyAuthfromdjangorestframework_api_gateway_authimportBasicApiGatewayApiKeyAuth@authentication_classes([BasicApiGatewayApiKeyAuth])defendpoint(request:HttpRequest):# ...This authenticator reads basic auth and ensures the username and password
match an API Gateway keycurl -u username:password -v localhost:8000/api/your/endpointWhereusernameis the name of your API key andpasswordis the API key
Package: djangorestframework-api-key-allowbynames
Django RESTframework-api key - Allow by key namesDecorator working withdjangorestframework-api-keyallowing to restrict access to a method according to the key
presented.UsageUse@allow_only_apikey()with a list of key names as the first parameter :from rest_framework_api_key_allowbynames.decorator import allow_only_apikey

class TelegramMemberCheck(APIView):
    permission_classes = [HasAPIKey]

    @allow_only_apikey(['TelegramBot'])
    def get(self, request, format=None):
        passIf the key does not match, anAuthenticationFailedis returned.
Package: django-rest-framework-apikeys
=====django-rest-framework-apikeys=====django-rest-framework-apikeys allows you to Authenticate your REST api with api keys on a per user basis.Install-----------1. Install via pip::pip install django-rest-framework-apikeysQuick start-----------1. Add "django-rest-framework-apikeys" to your INSTALLED_APPS settings like this::INSTALLED_APPS = [...'django_rest_framework_apikeys',]2. Add the authentication class::REST_FRAMEWORK = {'DEFAULT_AUTHENTICATION_CLASSES': (...'django_rest_framework_apikeys.authentication.APIKeyAuthentication',)}3. Run `python manage.py migrate`.4. Add urls to urlconf::urlpatterns = [...url(r'^apikeys/', include("django_rest_framework_apikeys.urls")),]5. Send a POST request to /apikeys/create/ to create API Key for user or create via admin6. Add 'x-api-key' to header to Authenticate via api key::response = requests.get(url="http://0.0.0.0:8000/endpoint,headers={"x-api-key": "fd8b4a98c8f53035aeab410258430e2d86079c93",},)
Package: django-rest-framework-async
OverviewAdds async support to Django REST Framework.Currently not production ready. Use at your own risk :)RequirementsPython 3.10+Django 4.1+Installationpip install django-rest-framework-asyncExamplefrom drfa.decorators import api_view
from drfa.views import APIView

class AsyncView(APIView):
    async def get(self, request):
        return Response({"message": "This is an async class based view."})


@api_view(['GET'])
async def async_view(request):
    return Response({"message": "This is an async function based view."})
Package: djangorestframework-authentication
DJANGO-RESTFRAMEWORK-AUTHENTICATIONDJANGO-RESTFRAMEWORK-AUTHENTICATION is an app to manage easily the authentication in Rest API. This library
supports classical Django’s and Json Web Token authentication, moreover it manages Google 0Auth 2.0Quick startAdd “authentication” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...,
    "rest_framework",
    "authentication",
]

If you are using JWT add "rest_framework_simplejwt"::

    INSTALLED_APPS = [
        ...,
        "rest_framework",
        "authentication",
        "rest_framework_simplejwt",
    ]Include the “authentication” URLconf in your project urls.py like this:path("api/", include("authentication.urls")),GOOGLE OAUTH 2.0To use Google OAuth 2.0 you must set in settings.py:GOOGLE_AUTHENTICATION = True
GOOGLE_AUTHENTICATION_CLIENT_ID = “your_client_id”
GOOGLE_AUTHENTICATION_CLIENT_SECRET = “your_client_secret”You should set GOOGLE_AUTHENTICATION_CLIENT_SECRET as enviroment variable because it is a sensible information.JWT AUTHENTICATIONTo use JWT authentication you must set in settings.py:JWT_AUTHENTICATION = TrueRemember add rest_framework_simplejwt to INSTALLED_APPS.You are free to use the authentication system that you wan. You can use either Google OAuth or JWT, and you can use both as well.
Package: django-rest-framework-camel-case
Django REST Framework JSON CamelCaseCamel case JSON support for Django REST framework.InstallationAt the command line:$ pip install djangorestframework-camel-caseAdd the render and parser to your django settings file.# ...REST_FRAMEWORK={'DEFAULT_RENDERER_CLASSES':('django_rest_framework_camel_case.render.CamelCaseJSONRenderer',# Any other renders),'DEFAULT_PARSER_CLASSES':('django_rest_framework_camel_case.parser.CamelCaseJSONParser',# Any other parsers),}# ...Swapping Renderer and ParserBy default the package usesrest_framework.renderers.JSONRendererandrest_framework.parsers.JSONParser.
If you want to use another renderer or parser, you must specify it in your django settings file.Currently Support'RENDERER_CLASS':('rest_framework.renderers.JSONRenderer','rest_framework.renderers.UnicodeJSONRenderer',# only available in DRF < 3.0'rest_framework_google_json_style_api.renderers.JSONRenderer','rest_framework_json_api.renderers.JSONRenderer',),'PARSER_CLASS':('rest_framework.parsers.JSONParser','rest_framework_google_json_style_api.parsers.JSONParser','rest_framework_json_api.parsers.JSONParser',)Specify it in your django settings file.# ...JSON_CAMEL_CASE={'RENDERER_CLASS':'rest_framework_google_json_style_api.renderers.JSONRenderer','PARSER_CLASS':'rest_framework_google_json_style_api.parsers.JSONParser',}# ...Underscoreize OptionsAs raised inhttps://github.com/krasa/StringManipulation/issues/8#issuecomment-121203018there are two conventions of snake case.#Case1(Packagedefault)v2Counter->v_2_counterfooBar2->foo_bar_2#Case2v2Counter->v2_counterfooBar2->foo_bar2By default, the package uses the first case. To use the second case, specify it in your django settings file.REST_FRAMEWORK={# ...'JSON_UNDERSCOREIZE':{'no_underscore_before_number':True,},# ...}Running TestsTo run the current test suite, execute the following from the root of he project:$ python -m unittest discoverLicenseFree software: BSD licenseHistory0.1.0 (2013-12-20)First release on PyPI.
Package: djangorestframework-camel-case2
Django REST Framework JSON CamelCaseCamel case JSON support for Django REST framework.Compatible with:Python: Python 3.5+Django: 2.2, 3.0+Django REST framework: 3.9, 3.10, 3.11Note: This is a replacement fordjangorestframework-camel-casewhich seems currently unmaintained.InstallationAt the command line::$pipinstalldjangorestframework-camel-case2Add the render and parser to your django settings file.REST_FRAMEWORK={'DEFAULT_RENDERER_CLASSES':('djangorestframework_camel_case2.render.CamelCaseJSONRenderer',# Any other renders),'DEFAULT_PARSER_CLASSES':('djangorestframework_camel_case2.parser.CamelCaseJSONParser',# Any other parsers),}Swapping RendererBy default the package usesrest_framework.renderers.JSONRenderer. If you want
to use another renderer (the only possible alternative isrest_framework.renderers.UnicodeJSONRenderer, only available in DRF < 3.0), you must specify it in your django
settings file.# ...JSON_CAMEL_CASE={'RENDERER_CLASS':'rest_framework.renderers.UnicodeJSONRenderer'}# ...Underscoreize OptionsAs raised inhttps://github.com/krasa/StringManipulation/issues/8#issuecomment-121203018there are two conventions of snake case.# Case 1 (Package default)
v2Counter -> v_2_counter
fooBar2 -> foo_bar_2

# Case 2
v2Counter -> v2_counter
fooBar2 -> foo_bar2By default, the package uses the first case. To use the second case, specify it in your django settings file.REST_FRAMEWORK={# ...'JSON_UNDERSCOREIZE':{'no_underscore_before_number':True,},# ...}Alternatively, you can change this behavior on a class level by settingjson_underscoreize:fromdjangorestframework_camel_case2.parserimportCamelCaseJSONParserfromrest_framework.genericsimportCreateAPIViewclassNoUnderscoreBeforeNumberCamelCaseJSONParser(CamelCaseJSONParser):json_underscoreize={'no_underscore_before_number':True}classMyView(CreateAPIView):queryset=MyModel.objects.all()serializer_class=MySerializerparser_classes=(NoUnderscoreBeforeNumberCamelCaseJSONParser,)Running TestsTo run the current test suite, execute the following from the root of the projectpoetryrunpytest
Package: djangorestframework-camel-case-2
Django REST Framework JSON CamelCaseCamel case JSON support for Django REST framework.InstallationAt the command line::pip install djangorestframework-camel-case-2Add the render and parser to your django settings file.# ...REST_FRAMEWORK={'DEFAULT_RENDERER_CLASSES':('djangorestframework_camel_case.render.CamelCaseJSONRenderer','djangorestframework_camel_case.render.CamelCaseBrowsableAPIRenderer',# Any other renders),'DEFAULT_PARSER_CLASSES':(# If you use MultiPartFormParser or FormParser, we also have a camel case version'djangorestframework_camel_case.parser.CamelCaseFormParser','djangorestframework_camel_case.parser.CamelCaseMultiPartParser','djangorestframework_camel_case.parser.CamelCaseJSONParser',# Any other parsers),}# ...Swapping RendererBy default the package usesrest_framework.renderers.JSONRenderer. If you want
to use another renderer (the only possible alternative isrest_framework.renderers.UnicodeJSONRenderer, only available in DRF < 3.0), you must specify it in your django
settings file.# ...
JSON_CAMEL_CASE = {
    'RENDERER_CLASS': 'rest_framework.renderers.UnicodeJSONRenderer'
}
# ...Underscoreize OptionsAs raised inhttps://github.com/krasa/StringManipulation/issues/8#issuecomment-121203018there are two conventions of snake case.# Case 1 (Package default)
v2Counter -> v_2_counter
fooBar2 -> foo_bar_2

# Case 2
v2Counter -> v2_counter
fooBar2 -> foo_bar2By default, the package uses the first case. To use the second case, specify it in your django settings file.REST_FRAMEWORK={# ...'JSON_UNDERSCOREIZE':{'no_underscore_before_number':True,},# ...}Running TestsTo run the current test suite, execute the following from the root of he project::make testLicenseFree software: BSD license
Package: djangorestframework-composed-permissions
Composed permissions for django-rest-frameworkA simple way to define complex permissions for django-rest-framework.Documentation:https://djangorestframework-composed-permissions.readthedocs.org/en/latest/DevelopmentRun tests with our settings using the following command:django-admintest restfw_composed_permissions--settings=restfw_composed_permissions.tests.settings_sqliteLicenseNew BSD License
Package: django-rest-framework-condition
django-rest-framework-conditionThis package allows you to use@conditiondecorator from Django on ViewSet or
APIView from Django Rest Framework. In other words, you can use http headers
ETag and Last-modified with you APIs.It doesn't create custom implementation of etags or last-modified header but uses ones from Django which means you can be sure it will be updated by Django's authors.Similarly as in Django you can use shortcut decorators@last_modifiedand@etag.Tested with:Python: 2.7, 3.7Django: 1.11, 2.0, 2.1, 2.2Django Rest Framework: 3.8, 3.9Installationpipinstalldjango-rest-framework-conditionUsageUse decorators same way as with Django views.Last-modified examplefromdatetimeimportdatetimefromrest_framework.responseimportResponsefromrest_framework.viewsimportAPIViewfromrest_framework_conditionimportlast_modifiedclassLastModifiedApiView(APIView):@last_modified(lambda_:datetime(2019,1,1))defget(self,request):returnResponse({'data':'I have Last-Modified header!'})ETag exampleimporthashlibfromrest_framework.responseimportResponsefromrest_framework.viewsimportAPIViewfromrest_framework_conditionimportetagdefmy_etag(request,*args,**kwargs):returnhashlib.md5(':'.join(request.GET.dict().values()).encode('utf-8')).hexdigest()classEtagApiView(APIView):@etag(my_etag)defget(self,request):returnResponse({'data':'I have Etag!'})Both ETag and Last-Modified exampleimporthashlibfromdatetimeimportdatetimefromrest_framework.responseimportResponsefromrest_framework.viewsimportAPIViewfromrest_framework_conditionimportconditiondefmy_etag(request,*args,**kwargs):returnhashlib.md5(':'.join(request.GET.dict().values()).encode('utf-8')).hexdigest()defmy_last_modified(request,*args,**kwargs):returndatetime(2019,1,1)classConditionApiView(APIView):@condition(etag_func=my_etag,last_modified_func=my_last_modified)defget(self,request):returnResponse({'data':'I have both Last-Modified and Etag!'})
Package: djangorestframework-constant-field
AConstantFieldtype for Django REST Framework.Installationpip install djangorestframework-constant-fieldUsageUsing this is really simple, just set thevalueattribute on your
serializer:fromrest_frameworkimportserializersfromrest_framework_constant.fieldsimportConstantFieldclassMySerializer(serializers.Serializer):"""Custom Serializer
    """my_value=ConstantField(value='My Value')serialized=MySerializer()print(serialized.data)# {#     'my_value': 'My Value',# }Why?This is useful when you’re building a serializer to integrate into some
third party system where some of your fields are pre-defined. The above
example is equivalent to:fromrest_frameworkimportserializersclassMySerializer(serializers.Serializer):"""Custom Serializer
    """my_value=serializers.SerializerMethodField()defget_my_value(self,obj):"""Excessive code.
        """return'My Value'Testing & ContributingTo build and test this package, simply fork this repo and:gitclonegit@github.com:<yourname>/djangorestframework-constant-field.gitcddjangorestframework-constant-fieldpipinstall-rrequirements.txtpythonsetup.pytestThe current app is almost completely contained insiderest_framework_constant.
Package: djangorestframework-custom-exceptions
Custom exceptions for django rest frameworkCompatibilityWorks with :Python 2.7, 3.4, 3.5, 3.6Django >= 1.10Django Rest Framework >= 3.5InstallationInstall the package from pypi:pip install djangorestframework-custom-exceptionsAdd the application in your django settings:INSTALLED_APPS = ('rest_framework_custom_exceptions',)Configure your rest framework :REST_FRAMEWORK = {
    'EXCEPTION_HANDLER': 'rest_framework_custom_exceptions.exceptions.simple_error_handler'
}ExampleThe simple error handler show exceptions like this :{
    "error": "Not found"
}
Package: djangorestframework-custom-filters
Custom filters for django rest frameworkCompatibilitywork with :Python 2.7 / 3.4Dango 1.6 / 1.7Django Rest Framework 2.4 / 3.0InstallationInstall the package from pypi:pip install djangorestframework-custom-filtersAdd the application in your django settings:DJANGO_APPS = ('rest_framework_custom_filters',)UsageUse it in your filters.py :import django_filters
import rest_framework_custom_filters

class MyFilter(django_filters.FilterSet):
    since = rest_framework_custom_filters.IsoDateTimeFilter(name='_per_modif', lookup_type='gte')
    ...
Package: djangorestframework-custom-paginations
Custom paginations for django rest frameworkCompatibilitywork with :Python 2.7 / 3.4Dango 1.6 / 1.7Django Rest Framework 2.4 / 3.0 / 3.1 / 3.2 / 3.3InstallationInstall the package from pypi:pip install djangorestframework-custom-paginationsAdd the application in your django settings:DJANGO_APPS = ('rest_framework_custom_paginations',)Configure your rest framework for DRF >= 3.1:REST_FRAMEWORK = {
    'DEFAULT_PAGINATION_CLASS': 'rest_framework_custom_paginations.classes.SporePagination',
}or configure your rest framework for DRF < 3.1:REST_FRAMEWORK = {
    'DEFAULT_PAGINATION_SERIALIZER_CLASS': 'rest_framework_custom_paginations.paginations.SporePaginationSerializer'
}UsageAdd the following parameters in a ListAPIView :class PersonList(generics.ListAPIView):
    """ list of person """
    ...
    paginate_by = 100
    paginate_by_param = 'page_size'
    max_paginate_by = 500ExampleResults of Spore Pagination :{
    "count": 532,
    "next": "http://myurls/persons.json?structure=mystructure&page=3",
    "next_params": {
        "page": 3,
        "structure": "mystructure"
    },
    "num_pages": 6,
    "previous": "http://myurls/persons.json?structure=mystructure&page=1",
    "previous_params": {
        "page": 1,
        "structure": "mystructure"
    },
    "results": [
        ...
    ]
}