Saravanan666/pypi-org huggingface dataset:
Package: django-grpc-secure
django-grpc-secureAdd secure part for django-grpcEasy way to launch gRPC server with access to Django ORM and other handy stuff.
gRPC calls are much faster that traditional HTTP requests because communicate over
persistent connection and are compressed. Underlying gRPC library is written in C which
makes it work faster than any RESTful framework where a lot of time is spent on serialization/deserialization.Note that you need this project only if you want to use Django functionality in gRPC service.
For pure python implementationread thisSupported Python: 3.4+Supported Django: 2.X and 3.XInstallationpipinstalldjango-grpc-secureUpdate settings.pyINSTALLED_APPS=[# ...'django_grpc_secure',]GRPCSERVER={'servicers':['dotted.path.to.callback.eg.grpc_hook'],# see `grpc_hook()` below'interceptors':['dotted.path.to.interceptor_class',],# optional, interceprots are similar to middleware in Django'maximum_concurrent_rpcs':None,}The callback that initializes "servicer" must look like following:importmy_pb2importmy_pb2_grpcdefgrpc_hook(server):my_pb2_grpc.add_MYServicer_to_server(MYServicer(),server)...classMYServicer(my_pb2_grpc.MYServicer):defGetPage(self,request,context):response=my_pb2.PageResponse(title="Demo object")returnresponseUsagepythonmanage.pygrpcserversecureyou can specify host by using--host localhostoptionuse--securefor using ssl modeAnd add below settings to your django project settings.py fileGRPC_PRIVATE_KEY=""# absolute path for private key *.pemGRPC_CERTIFICATE_CHAIN=""# absolute path for certificate_chain *.crtFor developer's convenience add--autoreloadflag during development.SignalsThe package uses Django signals to allow decoupled applications get notified when some actions occur:django_grpc.signals.grpc_request_started- sent before gRPC server begins processing a requestdjango_grpc.signals.grpc_request_finished- sent when gRPC server finishes delivering response to the clientdjango_grpc.signals.grpc_got_request_exception- this signal is sent whenever RPC encounters an exception while
processing an incoming request.Note that signal names are similar to Django's built-in signals, but have "grpc_" prefix.SerializersThere is an easy way to serialize django model to gRPC message usingdjango_grpc.serializers.serialize_model.TestingTest your RPCs just like regular python methods which return some
structure or generator. You need to provide them with only 2 parameters:
request (protobuf structure or generator) and context (useFakeServicerContextfrom the example below).client exampleimportgrpcimportmy_pb2importmy_pb2_grpcwithopen('xxx.crt','rb')asf:certificate_chain=f.read()creds=grpc.ssl_channel_credentials(root_certificates=certificate_chain)withgrpc.secure_channel('localhost:50051',creds)aschannel:stub=my_pb2_grpc.GreeterStub(channel)response=stub.Who(my_pb2.HelloRequest())print(response)In addition to standard gRPC context methods, FakeServicerContext provides:.set_invocation_metadata()allows to simulate metadata from client to server..get_trailing_metadata()to get metadata set by your server.abort_statusand.abort_messageto check if.abort()was called
Package: django-grunted-assets
=====================django-grunted-assets=====================Goal====- Have css and js compressed and cache busted in production- Have livereload work with css injection in development- Have livereload work with coffee-script files and html templates- Have node serve our staticfiles in development as it is way faster thandjango's runserver- Give the flexibility that compressor provides, linking arbitrary files in certain templates and locationsWhere django-compressor falls short===================================- Slow compile and reload- No css injection with livereload- Not the tools that grunt provides (autoprefixer, uglify, etc)- Inlining assetsHow it works============1. Put your static where you normally do, e.g. in a top level 'static' or'assets' dir, or in the 'static' dir in your app.2. Configure the paths in your gruntfile.3. Add ``{% load grunted_assets %}`` to your (base) template and link theassets you want to load with: ``{% link_asset 'script.js' %}``4. Run grunt (see below).5. Run ``django-admin.py collectstatic``The ``link_asset`` template tag (or the ``inline_asset`` tag), searches for thefiles in either ``.tmp`` (development) or ``dist`` (production) within``STATIC_ROOT``.The argument you pass to ``link_asset`` of ``inline_asset`` is treated as a regex. Asimple ``main.css`` therefore works, but using ``.*main\.js`` for example, you canalso match files processed with something like``grunt-rev<https://www.npmjs.com/package/grunt-rev>``_.Development-----------In development (``grunt`` or ``grunt develop``), grunt compiles sass and coffee-script to a ``.tmp`` dir inside 'static'. These files get served by node. Nocache busting here.All static will be served by ``connect`` on ``localhost:8001``, so set``STATIC_URL='http://localhost:8001``Production----------Run ``grunt dist`` and check the ``dist`` folder into source control. This willconcat, minify etc. all your js and css into 'main.css' and 'main.js' as youspecify in your gruntfile.On the server run ``django-admin.py collectstatic`` to have all static filescollected to the proper place.
Package: django-gsheets-import
django-gsheets-importThedjango-gsheets-importpackage is a Django application to facilitate data import from Google Sheets within Django's admin framework.
It extends the greatdjango-import-exportpackage, which already provides import and export capabilities for all local file formats supported bytablib.
Exporting data from Django's admin to Google Sheets is currently not supported but planned for a future release.Below, we briefly outline how to install and use the package.
A more detailed documentation aboutdjango-gsheets-importis availablehere.Installation and configurationThe package and its dependencies can be installed fromPyPIviapip install -U django-gsheets-import.
To use the package in your Django project, just addimport_exportandgsheets_importto the list ofinstalled appsin yoursettings.py, i.e.## in settings.pyINSTALLED_APPS=[...,'import_export','gsheets_import',...]In order fordjango-gsheets-importto work properly, it needs to be associated with an underlyingGoogle Cloud Project(GCP).
How to properly set up an appropriate GCP using the Google Cloud Console is described in more detail in the corresponding section of ourdocumentation.
At this point, let us just note that all of the services needed are available in Google Cloud'sFree Tier, so that there is no need to set up a billing account.
Assuming that a suitable GCP already exists, go to theGoogle Cloud Consoleand navigate toAPIs & Services > Credentials.
From there, copy anAPI key, as well as the desiredOAuth Client IDand add them to yoursettings.py.
The requiredproject numbercan be found underIAM & Admin > Settingsand must also be added tosettings.py, i.e.## in settings.pyGSHEETS_IMPORT_API_KEY='<Your API developers key>'GSHEETS_IMPORT_CLIENT_ID='<Your OAuth Client ID>'GSHEETS_IMPORT_APP_ID='<Your project number>'The package is now ready to be used with your Django project.Features and usageThedjango-gsheets-importpackage presented here strongly relies on the functionality provided by thedjango-import-exportpackage.
It extends that package by the option to allow the user to import data from their Google Sheets via the Django admin.
The usage ofdjango-gsheets-importis very similar to that ofdjango-import-export, which is nicely documentedhere.
It might also be instructive to have a look at the example Django project that ships withdjango-gsheets-import(see thedocumentationfor more details).In short, integrating the Google Sheets import feature offered bydjango-gsheets-importinto your Django project's admin site is a two-step process:Define aresourcewhich determines how the fields of a given model translate to their import (and export) representations.Define theadmin interfaceof the considered model as a subclass ofImportGoogleModelAdminor any of the other classes provided by the package'sadminsubmodule, namelyImportGoogleMixin,ImportGoogleExportModelAdmin, andImportGoogleExportMixin.
Package: django-gssapi
GSSAPI authentication for DjangoProvide GSSAPI (SPNEGO) authentication to Django applications.It’s a rewrite of django-kerberos using python-gssapi.It’s only tested with MIT Kerberos 5 using package k5test.Python 2 and 3, Django >1.8 are supported.Basic usageAdd this to your projecturls.py:url('^auth/gssapi/', include('django_gssapi.urls')),And use the default authentication backend, by adding that to yoursettings.pyfile:AUTHENTICATION_BACKENDS = (
    'django_gssapi.backends.GSSAPIBackend',
)Viewdjango-gssapi provide a base LoginView that you can subclass to get the
behaviour your need, the main extension points are:challenge()returns the 401 response with the challenge, you should override it
to show a template explaining the failure,success(user)it should log the given user and redirect to REDIRECT_FIELD_NAME,get_service_name()it should return a gssapi.Name for your service, by
default it returns None, so GSSAPI will match any name available (for example
with Kerberos it will match any name in your keytab, like
@HTTP/my.domain.com@).SettingsTo make your application use GSSAPI as its main login method:LOGIN_URL = 'gssapi-login'Your application need an environment where the GSSAPI mechanism like Kerberos
will work, for Kerberos it means having a default keytab of creating one and
setting its path in KRB5_KTNAME or you can useGSSAPI_STOREwith MIT Kerberos
5 and credential store extension to indicate a keytab:GSSAPI_STORE = {'keytab': 'FILE:/var/lib/mykeytab'}You can also force a GSSAPI name for you service with:import gssapi

GSSAPI_NAME = gssapi.Name('HTTP/my.service.com', gssapi.MechType.hostbased_service)GSSAPI authentication backendA dummy backend is provided indjango_gssapi.backends.GSSAPIBackendit looks
up user with the same username as the GSSAPI name. You should implement it for
your use case.A custom authentication backend must have the following signature:class CustomGSSAPIBackend(object):
    def authenticate(self, request, gssapi_name):
        passThe parametergssapi_nameis agssapi.Nameobject, it can be casted to
string to get the raw name.Kerberos username/password backendIf your users does not have their browser configured for SPNEGO HTTP
authentication you can also provide a classic login/password form which check
passwords using Kerberos. For this usedjango_gssapi.backends.KerberosPasswordBackend, the username is used as the
raw principal name.django-rest-framework authentication backendTo authenticate users with GSSAPI you can usedjango_gssapi.drf.GSSAPIAuthentication, it uses the configured GSSAPI
authentication backend to find an user and returns the GSSAPI name inrequest.auth.
Package: django-gss-spnego
A Django application for adding Kerberos/GSS authentication to your existing backendThis Django application provides someViewandMixinclasses along with a backendMixinclass to extend your existingAuthenticationBackendwith SPNEGO-based authentication.This provides additional flexibility over a Middleware solution that would require all users to
use/support SPNEGO all of the time, and just utilize GSSAPI on a specific login page to create a
login session as an alternative to typing in a username and password.PrereqsA working Kerberos KDC (MIT, Windows AD, Heimdall, whatever)A SPN for your application server(s)A method for mapping Kerberos Principals to User objects in your backendInstallationYou can install the pre-release development version from PyPi by specifying the exact version topip:pip installdjango-gss-spnego==21.10.1devOnce an official release is uploaded, you will not have to specify an exact version.ConfigurationThe following settings must be present:django_gss_spnegoinsettings.INSTALLED_APPSsettings.KERBEROS_SPNmay be set toSERVICENAME@HOSTNAMEieHTTP@django-server.
Setting it to “” means “try all SPNs in the host keytab”Environment variables to control your KRB5 installation.
See thekerberos envdocumentation for details.UsageMixdjango_gss_spnego.backends.SpnegoBackendMixininto your backend class(es) of choice.
Ensure those backends can resolve a User object from a kerberos principal name.fromdjango_auth_ldap.backendimportLDAPBackendfromdjango_gss_spnego.backendsimportSpnegoBackendMixinclassMyBackendClass(SpnegoBackendMixin,LDAPBackend):defget_user_from_username(self,username):returnself.populate_user(username)Register aforementioned backend class insettings.AUTHENTICATION_BACKENDSCreate a view somewhere on your site that usesSpnegoAuthMixin, and add it to your URL router.
If using one of the provided CBV View classes, also includedjango_gss_spnegoanddjango.contrib.adminin yoursettings.INSTALLED_APPSfor access to the spnego.html template.fromdjango_gss_spnego.viewsimportSpnegoViewurls.append(r"^auth/spnego$",SpnegoView.as_view(),name="spnego")Acquire a ticket, and point your favorite supported client at the endpointimportrequests_gssapiimportrequestsauth=requests_gssapi.HTTPSPNEGOAuth()sess=requests.session()sess.auth=authsess.get("http://localhost/auth/spnego")sess.get("http://localhost/page/that/requires/authorized_user")AcknowledgementsMatt Magin (AzMoo)for writing asimilar MiddlewareLicenseApache 2.0 – see the LICENSE file for more detail
Package: django-gst-field
django-gst-fieldA Django library which provides model and form fields forGoods and Services TaxandPermanent Account NumberIncludes:GSTField, form and model fieldPANField, form and model fieldInstallationpip install django-gst-fieldBasic usageAddgst_fieldto the list of the installed apps in Djangosettings.pyfile:INSTALLED_APPS=[...'gst_field',...]Model usagefromdjango.confimportsettingsfromdjango.db.modelsimportForeignKey,CASCADE,Modelfromgst_field.modelfieldsimportGSTField,PANFieldclassTax(Model):user=ForeignKey(settings.AUTH_USER_MODEL,on_delete=CASCADE)gstin=GSTField()pan=PANField()
Package: django-gstorage
This library is intended to be a ‘plug-and-play’ replacement
fordjango.core.files.storage.FileSystemStoragebut reading
and writing files from Google storage. So there are two goals -It should be possible to use this library in projects already
using local filesystem but which want to start using Google storage.
In this case, we read from Google storage but if that fails, read
from local filesystem and also update Google storage.Make it simpler to use newer features of Google storage like
encrypting files with sensitive informationorder_pdf=FileField(encrypted=True)ExamplesUsing the module to upload some files>>>fromgstorage.bucketimportBucket>>>bucket=Bucket.get_default()>>>bucket.copydir('share/storage/2016/10/01')Release history0.5.1 (2016-11-04)gstorage.storage.Storageimplements the interface expected fromdjango.core.files.storage.Storage.  The onlysupported interfaceat this point isstorage._save, and other methods are experimental.Support Python 3.4 for new Django (1.9 and 1.10)Added an example project showing use of django-gstorage0.4.1 (2016-10-30)Updated docstrings to sphinx styleAdded documentation for gstorage.utils0.4.0 (2016-10-30)FeaturesRefactored tests and added seperate test files for each module.Updated documentation on readthedocs.io to include section about
bucket.0.3.0 (2016-10-28)Featuresgstorage.bucket.Bucket.get_defaultallowing easy access to
default bucket.gstorage.bucket.Bucket.copydirallowing easy upload of files
to Google cloud.
Package: django-gsuite-email
GSuite Email BackendThis package allows to use Django'ssend_mailcommand to send emails through GSuite account.It requires a serviceaccount credential created in Google coud console,
The crendential file need to havehttps://www.googleapis.com/auth/gmail.sendscope.Followthis tutorialto create the credentials file, make sure to addhttps://www.googleapis.com/auth/gmail.sendscope.Installationpipinstalldjango-gsuite-emailQuick start1. Add it to installed apps insetings.pyINSTALLED_APPS=[...'django_gsuite_email',...]2. Set the Email EMAIL_BACKEND settingEMAIL_BACKEND='django_gsuite_email.GSuiteEmailBackend'3. Set location of credentials file.To do this, either setGSUITE_CREDENTIALS_FILEenvironment variable.ORsetGSUITE_CREDENTIALS_FILEinsettings.pyGSUITE_CREDENTIALS_FILE="/path/to/credentials/file.json"Note:GSUITE_CREDENTIALS_FILEinsettings.pywill take precedence over environment variable.4. Send emailsfromdjango.core.mailimportsend_mailsend_mail('Subject here','Here is the message.','from@example.com',['to@example.com'],fail_silently=False,)
Package: django-gtm
Google Tag Manager App-----Simple app that intends to simplify GTM configuration and allows to add namedsettings for different containers.Google Tag Manager https://tagmanager.google.comUsage===1. Do migrations2. Open GTM settings in the admin page3. Set value for Default GTM Settings4. Add named GTM Settings5. Use default or named GTM settings whenever you need in your templates.Examples===1. Custom code```{% gtm "GTM-FNHEHD" %}{% gtm_head "GTM-FNHEHD" %}{% gtm_body "GTM-FNHEHD" %}```2. Default value```{% gtm %}{% gtm_head %}{% gtm_body %}```3. Named settigns```{% gtm name="name1" %}{% gtm_head name="name1" %}{% gtm_body name="name1" %}```
Package: django-guac-auth
django-guac-auth=======================Django app to facilitate setting up Guacamole database items[![Build Status](https://travis-ci.org/nimbis/django-guac-auth.svg?branch=master)](https://travis-ci.org/nimbis/django-guac-auth)[![Coverage](https://coveralls.io/repos/nimbis/django-guac-auth/badge.png?branch=master)](https://coveralls.io/r/nimbis/django-guac-auth?branch=master)Requirements------------* django >= 1.8Installation------------* Run `pip install django-guac-auth` or download this package and run `python setup.py install`* Ensure that `guac_auth` is in your INSTALLED APPSContributing------------See the [Contributing Guidelines](CONTRIBUTING.md).History-------v1.0.0:* Initial version.Usage-----Several utility methods are provided.# Set up an RDP connection, guac user, and needed permissionsquick_rdp(guac_username="guactestuser", guac_password="guactest",username="Administrator", password="somepass",hostname="somehost")# Set up an RDP connection with the provided parametersquick_rdp_conn(username="Adminstrator", password="somepass",hostname="somehost"):# Set up a Guacamole userquick_guac_user(username="guactestuser", password="guactest"):# Destroy all bits set up by quick_rdp()quick_rdp_destroy(guac_username="guactestuser", username="Administrator",hostname="somehost", cleanup_user=True,cleanup_connection=True):
Package: django-guardian
django-guardianis an implementation of per object permissions[1]on top
of Django’s authorization backendDocumentationOnline documentation is available athttps://django-guardian.readthedocs.io/.RequirementsPython 3.5+A supported version of Django (currently 2.2+)GitHub Actions run tests against Django versions 2.2, 3.0, 3.1, 3.2, and main.InstallationTo installdjango-guardiansimply run:pip install django-guardianConfigurationWe need to hookdjango-guardianinto our project.Putguardianinto yourINSTALLED_APPSat settings module:INSTALLED_APPS=(...'guardian',)Add extra authorization backend to yoursettings.py:AUTHENTICATION_BACKENDS=('django.contrib.auth.backends.ModelBackend',# default'guardian.backends.ObjectPermissionBackend',)Createguardiandatabase tables by running:python manage.py migrateUsageAfter installation and project hooks we can finally use object permissions
withDjango.Lets start really quickly:>>>fromdjango.contrib.auth.modelsimportUser,Group>>>jack=User.objects.create_user('jack','jack@example.com','topsecretagentjack')>>>admins=Group.objects.create(name='admins')>>>jack.has_perm('change_group',admins)False>>>fromguardian.modelsimportUserObjectPermission>>>UserObjectPermission.objects.assign_perm('change_group',jack,obj=admins)<UserObjectPermission:admins|jack|change_group>>>>jack.has_perm('change_group',admins)TrueOf course our agent jack here would not be able tochange_groupglobally:>>>jack.has_perm('change_group')FalseAdmin integrationReplaceadmin.ModelAdminwithGuardedModelAdminfor those models
which should have object permissions support within admin panel.For example:fromdjango.contribimportadminfrommyapp.modelsimportAuthorfromguardian.adminimportGuardedModelAdmin# Old way:#class AuthorAdmin(admin.ModelAdmin):#    pass# With object permissions supportclassAuthorAdmin(GuardedModelAdmin):passadmin.site.register(Author,AuthorAdmin)[1]Great paper about this feature is available atdjangoadvent articles.
Package: django-gubbins
django-gubbins is a collection of useful snippets for enhancing
or replacing functionality within Django. For more documentation, see the github
page athttps://github.com/carlio/django-gubbinsAutomatic downcasting to model subclasses :
This is for the case when you have a model hierarchy, with several models inheriting from
a base class, and you want to query the base class but get instances of the subclasses
out of the query set.EnumField: provides an easy way to have a model field which only accepts
some values, and at the same time makes it easy to reference those values in your code.JSONField: allows you to store JSON strings in a database.ReusableAppURLs: a simple way to create the correct URL configuration for a reusable
django app.SlowFileUploadHandler: can be used to really slow down handling of file uploads.
This is an implementation of the Django file upload handler which will sleep between
processing chunks in order to simulate a slow upload. This is intended for development
when creating features such as an AJAXy file upload progress bar, as uploading to a
local process is often too quick.
Package: django-guestbook
What is it?Guestbook is a simple guestbook application for
the Django web-framework. It is closely based
on the contributed comments application.Guestbook is build to work against a late
pre-1.0 checkout and should be 1.0-compatible.More info about this app can be found in the blog
post introducing it at:http://cooking.visualspace.nl/post/9992059/Django-Guestbook-applicationStatusThis app is currently being used in several small-scale production environments.
However, it is probably that it still has a few kinks so feel free to submit bugfixes.InstallationGet it from the Cheese Shop:easy_install django-guestbookOrget the latest & greatest from Github and link it to your
application tree:git clone git://github.com/dokterbob/django-guestbook.git
ln -s django-guestbook/guestbook $PROJECT_DIR/guestbook(Here$PROJECT_DIRis your project root directory.)Add popularity toINSTALLED_APPSin settings.py:INSTALLED_APPS = (
    ...
    'guestbook',
    ...
)Create required data structure:cd $PROJECT_DIR
./manage.py syncdbAdd guestbook views tourls.py:urlpatterns += patterns('',
    ...
    (r'^guestbook/', include('guestbook.urls')),
    ...
)Enjoy!
Package: django-guest-user
django-guest-userAllow visitors to interact with your site like a temporary user ("guest")
without requiring registration.Anonymous visitors who request a decorated page get a real temporary user object
assigned and are logged in automatically. They can use the site like a normal
user until they decide to convert to a real user account to save their data.Inspired by and as an alternative fordjango-lazysignupand rewritten for Django 3.2+ and Python 3.8+.DocumentationFind thecomplete documentationon Read the Docs.QuickstartInstall thedjango-guest-userpackage from PyPIAddguest_userto yourINSTALLED_APPSand migrate your databaseAddguest_user.backends.GuestBackendto yourAUTHENTICATION_BACKENDSIncludeguest_user.urlsin your URLsDecorate your views with@allow_guest_user:fromguest_user.decoratorsimportallow_guest_user@allow_guest_userdefmy_view(request):assertrequest.user.is_authenticatedreturnrender(request,"my_view.html")A more detailed guide is available in theinstallation documentation.ContributingAll contributions are welcome! Please read thecontributing guidelinesin this repostory.Development StatusThis project is under active development. Thanks toprevious workthe core
functionality is well-established and this package builds on top of it.This project was created because the original project has been in an inactive
state without major updates in a long time. The code base was rewritten with
only modern versions of Python and Django in mind.