Saravanan666/pypi-org huggingface dataset:
Package: django-push-notification-service-firebash
django_firebash_push_serviceRequirementspython >= 3.6
django >= 3
djangorestframework
requestsInstallable AppThis app can be installed and used in your django project by:$ pip install django-firebash-push-service
Edit your settings.py file to include 'dj_push' in the INSTALLED_APPS listing.INSTALLED_APPS = [
...'dj_push.apps.DjPushConfig',]also add SERVER_TOKEN in your setting.you can get SERVER_TOKEN from firebash.Edit your project urls.py file to import the URLs:
from dj_push.urls import urlpatternsurl_patterns = [
...
] + urlpatternsFinally, add the models to your database:$ ./manage.py migrateThe "project" Branch
The master branch contains the final code for the PyPI package. There is also a project branch which shows the "before" case -- the Django project before the app has been removed.$ GuideFirst save device token$ api_endpoint = domain + 'device/token/create', Use this endpoint for creating device token
$ payload = {
$    "token": device_token,
$    "device_os: "android"
$ }$ api_endpoint = domain + 'device/token/get', Use this endpoint for get device tokenafter save token use this method for send notification
notice = NotificationSend(user=user_id, message=message, title=title)
response_msg = notice.send_device_notification()Docs & Source
Article:https://pypi.org/user/bajpairitesh878/Source:https://gitlab.com/bajpairitesh878/django_firebash_push_servicePyPI:https://pypi.org/user/bajpairitesh878/
Package: django-push-redirect
Django HTTP/2 Server Push redirectsA Django middleware that adds a HTTP/2 Server Push header to plain
Django redirect responses.This approach requires Django to be proxied by a server with
HTTP/2 Server Push support. E.g.nginx>=1.13.9,apache2>=2.4.26withmod_http2enabled or a CDN services like Cloudflare.InstallationThis package is available on PyPI and can be installed withpip:pipinstalldjango-push-redirectConfigurationFirst configure your webserver to enable HTTP/2 and enable server push.This looks something like this for nginx:server{listen443sslhttp2;listen[::]:443sslhttp2;...location@python{proxy_set_headerX-Forwarded-Proto$scheme;http2_push_preloadon;...}}The configuration for Apache and other servers/services is left as an
exercise for the reader (in other words, I don't know, please
contribute if you do!).Now make sure Django is able to detect if a request is secure
by configuring theSECURE_PROXY_SSL_HEADERsetting, e.g.:SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO','https')Then add'push_redirect.middleware.Http2ServerPushRedirectMiddleware'to your project'sMIDDLEWARE, make sure it'sbeforeDjango'sCommonMiddleware:MIDDLEWARE=[...'push_redirect.middleware.Http2ServerPushRedirectMiddleware','django.middleware.common.CommonMiddleware',...]This middleware adds theLink rel=preloadheader on redirect
responses that should be preloaded.If everything is configured correctly you should see that redirects
no longer require an extra request the the webserver.Response opt-outIt is possible for a response to explicitly opt-out from the having
apreloadheader added. This is done by settingallow_push_redirecttoFalseon theresponseobject, e.g.:defopt_out(request):response=HttpResponseRedirect("/")response.allow_push_redirect=FalsereturnresponseInspiration / Referenceshttps://twitter.com/simonw/status/1047865898717966337https://www.ctrl.blog/entry/http2-push-redirectshttps://www.nginx.com/blog/nginx-1-13-9-http2-server-push/https://httpd.apache.org/docs/2.4/howto/http2.html#pushhttps://www.cloudflare.com/website-optimization/http2/serverpush/https://code.djangoproject.com/ticket/29925
Package: django-puzzledev-jom
django-jom is a Django/Javascript implementation of the SSMVC pattern. Interactive, rich and mobile web applications are based on the MVC pattern in which models contains the data on which the application is built. However mobile and Javascript clients are forced to replicate the MVC pattern in order to operate. The SSMVC pattern avoid code duplication by automatically extracting and synchronizing the front-end models with back-end.
Package: django-pwdprotect
Easy password-protected URLs for your Django website.InstallInstall via pip:pip installdjango-pwdprotect.AddpwdprotectyourINSTALLED_APPS.Addpwdprotect.middleware.PasswordProtectMiddlewareto yourMIDDLEWAREsettings.Run migrationspython manage.py migrate pwdprotect.UsageAfter installation you can add protected URLs via the Django admin. Only local URLs starting with a/are allowed (do not include the site domain). The middleware will then check each request and prompt the user to log in if required.ContributingReview contribution guidelines atCONTRIBUTING.md.
Package: django-pwned
Django PwnedA collection of django password validators.CompatibilityPython:3.6,3.7,3.8,3.9,3.10Django:3.2,4.0Installationpip install django-pwnedFor translations to work, adddjango_pwnedtoINSTALLED_APPS.TL;DR:AUTH_PASSWORD_VALIDATORS=[{"NAME":"django.contrib.auth.password_validation.UserAttributeSimilarityValidator"},{"NAME":"django_pwned.validators.GitHubLikePasswordValidator"},{"NAME":"django_pwned.validators.MinimumUniqueCharactersPasswordValidator"},{"NAME":"django_pwned.validators.PwnedPasswordValidator"},]ValidatorsPwnedPasswordValidator(request_timeout=1.5)This validator uses thePwned Passwords APIto check for compromised passwords.Internally, this validator checks password with django'sCommonPasswordValidatorand if password was not in django's list,
uses Pwned API to check password. So you can removeCommonPasswordValidatorif you're using this validator.AUTH_PASSWORD_VALIDATORS=[# ...# {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},{"NAME":"django_pwned.validators.PwnedPasswordValidator"},# ...]You can set the API request timeout with therequest_timeoutparameter (in seconds).If for any reason (connection issues, timeout, ...) the request to Pwned API fails,
this validator skips checking password.GitHubLikePasswordValidator(min_length=8, safe_length=15)Validates whether the password is at least:8 characters long, if it includes a number and a lowercase letter, or15 characters long with any combination of charactersBased on Github's documentation aboutcreating a strong password.You may want to disable Django'sNumericPasswordValidatorandMinimumLengthValidatorif you want to useGitHubLikePasswordValidator.The minimum number of characters can be customized with themin_lengthparameter. The length at which we remove the restriction about
requiring both number and lowercase letter can be customized with thesafe_lengthparameter.MinimumUniqueCharactersPasswordValidator(min_unique_characters=4)Validates whether the password contains at least 4 unique characters.
For exampleaaaaaaaaaabbbbbbcccis an invalid password, butaAbBis a valid password.The minimum number of unique characters can be customized with themin_unique_charactersparameter.DevelopmentCreate and activate a python virtualenv.Install development dependencies in your virtualenv:pip install -e '.[dev]'Install pre-commit hooks:pre-commit installRun tests with coverage:py.test --covLicenseMIT
Package: django-pwned-passwords
django-pwned-passwords is a Django password validator that checks Troy Hunt’s PWNED Passwords API to see if a password has been involved in a major security breach before.Note: This app currently sends a portion of a user’s hashed password to a third party. Before using this application, you should understand how that impacts you.DocumentationThe full documentation is athttps://django-pwned-passwords.readthedocs.io.RequirementsDjango [1.9, 2.1]Python 2.7, [3.5, 3.6, 3.7]QuickstartInstall django-pwned-passwords:pip install django-pwned-passwordsAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'django_pwned_passwords',...)Add django-pwned-passwords’s PWNEDPasswordValidator:AUTH_PASSWORD_VALIDATORS=[...{'NAME':'django_pwned_passwords.password_validation.PWNEDPasswordValidator'}]FeaturesThis password validator returns a ValidationError if the PWNED Passwords API
detects the password in its data set. Note that the API is heavily rate-limited,
so there is a timeout (PWNED_VALIDATOR_TIMEOUT).IfPWNED_VALIDATOR_FAIL_SAFEis True, anything besides an API-identified bad password
will pass, including a timeout. IfPWNED_VALIDATOR_FAIL_SAFEis False, anything
besides a good password will fail and raise a ValidationError.SettingsSettingDescriptionDefaultPWNED_VALIDATOR_TIMEOUTThe timeout in seconds. The validator will not wait longer than this for a response from the API.2PWNED_VALIDATOR_FAIL_SAFEIf the API fails to get a valid response, should we fail safe and allow the password through?TruePWNED_VALIDATOR_URLThe URL for the API in a string format.https://haveibeenpwned.com/api/v2/pwnedpassword/{short_hash}PWNED_VALIDATOR_ERRORThe error message for an invalid password."Your password was determined to have been involved in a major security breach."PWNED_VALIDATOR_ERROR_FAILThe error message when the API fails. Note: this will only display ifPWNED_VALIDATOR_FAIL_SAFEisFalse."We could not validate the safety of this password. This does not mean the password is invalid. Please try again later."PWNED_VALIDATOR_HELP_TEXTThe help text for this password validator."Your password must not have been detected in a major security breach."PWNED_VALIDATOR_MINIMUM_BREACHESThe minimum number of breaches needed to raise an error1Rate LimitingHistorically, requests to the API were rate limited. However, with the new k-anonymity model-based API, there are no such rate limits.Running Testssource <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistorySee Github Releases
Package: django-pwnedpasswords-validator
django-pwnedpasswords-validatoris a Django password validator that
checks if a user-provided password exists in a data breach using thePwned Passwords v2
API. All provided
password data isk-anonymizedbefore
being sent to the API, so plaintext passwords never leave your server.Fromhttps://haveibeenpwned.com/API/v2#PwnedPasswords:Pwned Passwords are more than half a billion passwords which have
previously been exposed in data breaches. The service is detailed in
thelaunch blog
postthenfurther expanded on with the release of version
2.
The entire data set isboth downloadable and searchable online via
the Pwned Passwords page.Installationdjango-pwnedpasswords-validator is available for download throughPyPi.
You can install it right away using pip.pipinstalldjango-pwnedpasswords-validatorThen, add django-pwnedpasswords-validator to yourINSTALLED_APPS:INSTALLED_APPS=(...'django_pwnedpasswords_validator')Finally, add django-pwnedpasswords-validator toAUTH_PASSWORD_VALIDATORS:AUTH_PASSWORD_VALIDATORS=[...{'NAME':"django_pwnedpasswords_validator.validation.PwnedPasswordValidator"}]If you’d like to customize the error message (the default is“This
password has previously appeared in a data breach and should not be
used.”), you can pass in an alternate in theOPTIONSparameter for
the validator.AUTH_PASSWORD_VALIDATORS=[...{'NAME':"django_pwnedpasswords_validator.validation.PwnedPasswordValidator",'OPTIONS':{'error_text':"Your password was found in a data breach.",}}]Security NoteNo plaintext passwords ever leave your server using
django-pwnedpasswords-validator.How does that work? Well, the Pwned Passwords v2 API has a pretty coolk-anonymityimplementation.Fromhttps://blog.cloudflare.com/validating-leaked-passwords-with-k-anonymity/:Formally, a data set can be said to hold the property of
k-anonymity, if for every record in a released table, there are k −
1 other records identical to it.This allows us to only provide the first 5 characters of the SHA-1 hash
of the password in question. The API then responds with a list of SHA-1
hash suffixes with that prefix. On average, that list contains 478
results.People smarter than I am have usedmathto prove that 5-character prefixes are sufficient to maintain
k-anonymity for this database.In short: your plaintext passwords are protected if you use this
library. You won’t leak any enough data to identity which passwords
you’re searching for.ThanksSpecial thanks toTroy Huntfor
collecting this data and providing this service.AuthorsDan LoewenherzSee alsopwnedpasswords, a
command-line utility and Python library for the Pwned Passwords v2 API.LicenseApache License, Version 2.0. SeeLICENSEfor details.
Package: django-pwned-validator
This package provides a password validator for Django that checks submitted
passwords against thePwned Passwords API.To protect the security of the password being checked a range search is used. Specifically,
only the first 5 characters of a SHA-1 password hash are sent to the API. The
validator then locally looks for the full hash in the range returned.Installationpipinstalldjango-pwned-validatorModify yoursettings.pyto install the app and enable the validator:INSTALLED_APPS=['pwned.apps.PwnedConfig',...]AUTH_PASSWORD_VALIDATORS=[{'NAME':'pwned.validators.PwnedValidator',},...]CompatibilitySupports Django 2.2 to 3.2 on Python 3.5 to 3.8.
Package: django-pwny
Have I Been Pwned?password validator. Inspired by ablog poston the subject.QuickstartInstall django-pwny:pip install django-pwnyAdd it to yourAUTH_PASSWORD_VALIDATORS:AUTH_PASSWORD_VALIDATORS=[..."pwny.validation.HaveIBeenPwnedValidator",...]FeaturesTODORunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install Django requirements/test.txt
(myenv) $ toxCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackage
Package: django-pxpay
PaymentExpress PxPay Gateway for DjangoInstallation:pip installdjango-pxpayoreasy_installdjango-pxpayUsage:You’ll need to add a few items in yoursettings.py:PXPAY_USERID,PXPAY_KEYand, optionally,PXPAY_CURRENCY.fromdjango.shortcutsimportredirect,render_to_responsefromdjango.template.contextimportRequestContextfromdjango.httpimportHttp404frompxpay.gatewayimportGatewaydefpayment(request,amount):# Create a transaction.txn=Gateway().transaction(TxnType='Purchase',AmountInput='%.2f'%amount,CurrencyInput='AUD',# Alternatively, can be provided in settings.pyMerchantReference='Some reference')# Send payment request.response=Gateway().process_transaction(txn,UrlFail=request.build_absolute_uri(reverse('process_payment')),UrlSuccess=request.build_absolute_uri(reverse('process_payment')))# Redirect to PaymentExpress hosted payment page.ifresponse.is_valid:returnredirect(response.get_data['URI'])# Show error.else:returnpayment_result(request,False,'Invalid Transaction Request')defprocess_payment(request):# Proper PaymentExpress request would always have these.if'result'inrequest.GETand'userid'inrequest.GET:# Process PaymentExpress response.process_response=Gateway().process_response(Response=request.GET['result'])# Show payment result.returnpayment_result(request,bool(int(process_response.get_data['Success'])),process_response.get_data['ResponseText'])# Rise 404 if no required arguments were passed.raiseHttp404defpayment_result(request,success,msg):returnrender_to_response('payment.html',{'success':success,'msg':msg},context_instance=RequestContext(request))
Package: django-pyas2
django-pyas2is an AS2 server/client written in python and built on the django framework.
The application supports AS2 version 1.2 as defined in theRFC 4130. Our goal is to provide a native
python library for implementing the AS2 protocol. It supports Python 3.6+django-pyas2includes a set of django-admin commands that can be used to send files as
a client, send asynchronous MDNs and so on. It also has a web based front end interface for
configuring partners and organizations, monitoring message transfers and also initiating new transfers.FeaturesTechnicalAsynchronous and Synchronous MDNPartner and Organization managementDigital signaturesMessage encryptionSecure transport (SSL)Support for SSL client authenticationSystem task to auto clear old log entriesData compression (AS2 1.1)Multinational support: Uses Django’s internationalization featureIntegrationEasy integration to existing systems, using a partner based file system interfaceMessage post processing (scripting on receipt)MonitoringWeb interface for transaction monitoringEmail event notificationThe following encryption algorithms are supported:Triple DESRC2-128RC4-128AES-128AES-192AES-256The following hash algorithms are supported:SHA-1SHA-224SHA-256SHA-384SHA-512DocumentationYou can find more information in thedocumentation.DiscussionIf you run into bugs, you can file them in ourissue tracker.ContributeCheck for open issues or open a fresh issue to start a discussion around a feature idea or a bug.Forkthe repositoryon GitHub to start making your changes to themasterbranch (or branch off of it).Create your feature branch:git checkout -b my-new-featureCommit your changes:git commit -am ‘Add some feature’Push to the branch:git push origin my-new-featureSend a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself toAUTHORS.Running TestsInstalldjango-environandpytestinto your environment to support the
example.settings module and test framework.To rundjango-pyas2'stest suite:django-admin.pytest pyas2--settings=example.settings--pythonpath=.LicenseGNU GENERAL PUBLIC LICENSEVersion 3, 29 June 2007Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Package: django-pyc
django-pycdjango-pyc is a package that implements additional commands for Django’smanage.pycommand.django-pyc allows to remove or recompile all.pycfiles in the project or
Python libraries.InstallationInstall withpiporpipenv:pipinstalldjango-pycAdddjango_pycto your installed apps in your settings.py file:INSTALLED_APPS=['django_pyc',...]CommandsclearpycClears .pyc files from the project.Options:--noinputDo NOT prompt the user for input of any kind.-f,--forceForce the removing files without user interaction.-p,--with-pythonpathRemove also PYTHONPATH libraries.pathDirectories with librariesExample:Run command forapplicationdirectory only, without prompts and list
processed files:./manage.pyclearpyc--noinput--verbosity2applicationcompilepycCompiles .pyc files in the project.Options:-f,--forceForce the compiling files even if timestamps are up-to-date.-p,--with-pythonpathCompile also PYTHONPATH libraries.pathDirectories with librariesExample:Run command Run command forapplicationdirectory only and list processed
files:./manage.pycompilepyc--verbosity2applicationDocumentationSeehttp://django-pyc.readthedocs.org/LicenseCopyright © 2014, 2019, Piotr RoszatyckiThis software is distributed under the GNU Lesser General Public License (LGPL
3 or greater).
Package: django-pycdi
A middleware to integratePyCDIwithDjango.See thecode of conduct.InstallInstall pypi versionpipinstalldjango_pycdiInstall lastest versionpipinstallgit+https://github.com/ettoreleandrotognoli/django-pycdi.gitUsageAdd middleware to settings.py:MIDDLEWARE+=['django_pycdi.middlewares.CDIMiddleware']Add inject decorator to your views:WithPython 2:fromrandomimportrandomfromdjango.httpimportHttpResponsefrompycdiimportInject,Producerfrompycdi.utilsimportSingleton@Singleton()classMySingleton():pass@Producer(float)defget_a_float():returnrandom()@Inject(singleton=MySingleton,number=float)defview(request,singleton,number):returnHttpResponse('...')In the demo3 folder has a django demo project using python2 with more examples.WithPython 3:fromrandomimportrandomfromdjango.httpimportHttpResponsefrompycdiimportInject,Producerfrompycdi.utilsimportSingleton@Singleton()classMySingleton():pass@Producer()defget_a_float()->float:returnrandom()@Inject()defview(request,singleton:MySingleton,number:float):returnHttpResponse('...')In the demo3 folder has a django demo project using python3 with more examples.See more ways to usePyCDIin its page.
Package: django-pycharm
django-pycharmApp for Django to run any Python script within Django contextInstallationYou can install the plugin by runningpipinstalldjango-pycharmInsettings.pyadddjango-pycharmto yourINSTALLED_APPSINSTALLED_APPS+=['django_pycharm']Usagepythonmanage.pyrunscript<your_script.py>pythonmanage.pyinstall_pycharm_commands
Package: django-pycharm-breakpoint
App forDjangoto enter PyCharm debugger on uncaught exceptionsFree software: BSD licenseFeaturesUncaught exceptions in django view implementations (and middlewares) will trigger the PyCharm
debuggerInstallationYou can install the plugin by runningpip install django-pycharm-breakpointInsettings.pyadddjango-pycharm-breakpointto yourINSTALLED_APPSINTALLED_APPS += [‘django_pycharm_breakpoint’]UsageWhen running in the PyCharm debugger and the package is installed and added to theINSTALLED_APPSdjango setting, any uncaught exception will trigger a breakpoint in PyCharm.
Package: django-pycharm-debug-middleware
django-pycharm-debug-middlewareA django middleware to debug exceptions in PyCharm’s PyDev debugger.Simply add the ExceptionMiddleware to your middleware classes and run PyCharm in Debug mode to handle Exceptions within PyCharm’s PyDev Debugger.UsageAppend the middleware to your MIDDLEWARE_CLASSES and activate DEBUG_PROPAGATE_EXCEPTIONS:MIDDLEWARE_CLASSES += ('pycharm_debug_middleware.middleware.ExceptionMiddleware', )
DEBUG_PROPAGATE_EXCEPTIONS = True
Package: django-pyctx
PyCTX for Djangodjango-pyctxis a context package to use data between function calls, use timers and log it.For detailed documentation please visitWiki.Quick StartAdddjango_pyctxto yourINSTALLED_APPSsetting like this:INSTALLED_APPS=[#...,"django_pyctx",]Adddjango_pyctx.middlewares.RequestCTXMiddlewareto yourMIDDLEWAREsetting like this:MIDDLEWARE=["django_pyctx.middlewares.RequestCTXMiddleware",# ...,]Please add "django_pyctx.middlewares.RequestCTXMiddleware" to at the beginning of the MIDDLEWARE list.Start the development server and enjoy :)Sample UsageYou can reachRequestContextinstance inviewsfromrequest:request.ctxExample django function-basedview:fromdjango.httpimportJsonResponsedefindex(request):y=5withrequest.ctx.log.timeit('index_timer'):request.ctx.log.set_data('isEven',y%2)request.ctx.log.set_data('y',y)request.ctx.log.start_timer('timer1')importtimetime.sleep(0.3)request.ctx.log.stop_timer('timer1')time.sleep(0.8)returnJsonResponse({})You can see the stdout. You are probably seeing something like this:{"type":"REQ","ctxId":"a9b66113-aa96-4419-b9ec-961ce0ebf3ae","startTime":"2019-08-23 13:47:46.146172","endTime":"2019-08-23 13:47:47.258287","data":{"isEven":1,"y":5},"timers":{"ALL":1.112128,"request":1.112115,"index_timer":1.107513,"timer1":0.302767},"http":{"request":{"method":"GET","path":"/ctxtest","qs":"","full_path":"/ctxtest","is_secure":false,"is_xhr":false,"headers":{"Content-Length":"","Content-Type":"text/plain","Host":"localhost:8000","Connection":"keep-alive","Cache-Control":"max-age=0","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36","Sec-Fetch-Mode":"navigate","Sec-Fetch-User":"?1","Dnt":"1","Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3","Sec-Fetch-Site":"none","Accept-Encoding":"gzip, deflate, br","Accept-Language":"tr,en-GB;q=0.9,en;q=0.8,en-US;q=0.7","Cookie":"Pycharm-358d8f24=40efd37d-3767-43c2-8704-8abdbc8e441c; hblid=2S0d7GIKtYrYxbaF3m39N0M07TEBJbrW; olfsk=olfsk09308937734654421; Pycharm-358d92e3=f744a971-3d23-48a3-8188-7818d8efeb90; jenkins-timestamper-offset=-10800000; Pycharm-358d92e4=39469e28-3138-45a1-8133-16b05a158037; __test=1; csrftoken=qAbZmh519QGb6c1h702qe3YOtL8Q0ADakbXqqj4o5G5UznTybJVPigGG1mDBTtgP; Idea-535a2bcb=d87ec75d-65c5-46dd-a04b-6e914b434b5a; lang=en-US; iconSize=32x32; JSESSIONID.3e560a2e=node015mpq963ev6tulzcbplgyu8i1438.node0"}},"client":{"ip":"127.0.0.1","host":"","agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36"},"status":{"code":200,"phrase":"OK"},"server":{"name":"1.0.0.127.in-addr.arpa","port":"8000"},"view":"run"}}NOTE: this output formatted