Saravanan666/pypi-org huggingface dataset:
Package: django-rossvyaz
Приложение содержит:Таблица данных привязки номера телефона к региону (только Россия - РФ), взятая из Россвязи (Федеральное агенство связи);Система импорта из разных источников (Сейчас есть только для диапозона DEF);Небольшой QuerySet Manager;УстановкаПроделываем в командной строке$ git clone git://github.com/satels/django-rossvyaz.git
$ cd django-rossvyaz
$ python setup.py installПотом следует добавить ‘django_rossvyaz’ в INSTALLED_APPS и выполнить$ python manage.py syncdb  # Django < 1.7
$ python manage.py migrate django_rossvyaz  # Django >= 1.7НастройкаДобавить app в settings.pyINSTALLED_APPS = [
    ..
    'django_rossvyaz',
    ..
]Необязательные параметры (в settings.py):ROSSVYAZ_CODING - дефолтная кодировка файла с таблицей от РосСвязи (по-умолчанию windows-1251).ROSSVYAZ_SOURCE_URLS - ссылки на файлы на сайте-источнике (сейчас по-умолчанию только DEF диапозон)ROSSVYAZ_SEND_MESSAGE_FOR_ERRORS - отправлять ли сообщения об ошибках на почту при обновлении (по-умолчание, True)ИспользованиеДля получения объекта (для определения региона)from __future__ import print_function, unicode_literals
from django_rossvyaz.logic import clean_phone, CleanPhoneError
from django_rossvyaz.models import PhoneCode

try:
    phone = clean_phone('89687298907', PhoneCode.PHONE_TYPE_DEF)
except CleanPhoneError as e:
    raise e

phonecodes = PhoneCode.objects.by_phone(phone)
if phonecodes.exists():
    for num, phonecode in enumerate(phonecodes.iterator()):
        print('Найден #{}'.format(num + 1))
        print(phonecode.first_code)  # 968
        print(phonecode.from_code, phonecode.to_code)  # Диапозон кодов (В этом примере: '3500000'-'7999999')
        print(phonecode.block_size)  # Кол-во номеров в диапозоне (4500000)
        print(phonecode.operator)  # Оператор связи ('ВымпелКом')
        print(phonecode.region)  # Код региона (или название региона) (77)
        print(phonecode.phone_type)  # 'def'Пример использования через Postgres SQLSELECT
    regioncode.region_name AS region_name
FROM
    phones_phone AS phone,
    django_rossvyaz_phonecode AS phonecode,
    regions_regioncode AS regioncode
WHERE
    regioncode.region_id = phonecode.region AND
    substring(phone.phone from 3 for 3) = phonecode.first_code AND
    substring(phone.phone from 6 for 8)::int >= phonecode.from_code::int AND
    substring(phone.phone from 6 for 8)::int <= phonecode.to_code::int AND
    phone.id = 5Обновления базыЧтобы обновить базу$ python manage.py rossvyaz_update --phone-type=def --clean-regionРекомендуется обновлять базу с кодами отсюда:https://zniis.ru/bdpn/operators/router-table- скачивается файл XLSX, форматируете в CSV формат (можно использовать этот сервис для форматирования:https://www.kontrolnaya-rabota.ru/convert/xlsx2csv/):zniis.csv$ python manage.py rossvyaz_update --phone-type=def --encoding='utf-8' --filename=/path/to/zniis.csvГотовое APIНо номеру:https://calltools.ru/lk/cabapi_external/api/v1/def_codes/by_phone/?phone=9687298907Вся база:https://calltools.ru/lk/cabapi_external/api/v1/def_codes/all/
Package: django-rotate-secret-key
Helps rotating your secret keys safely without losing user sessions, which means without logging users out.Compatible with modern Django versions. At the moment of writing that’s including 1.11 and 2.0 on Python 3.7.I haven’t found any library to allow us to do this on our production website, so I started the library.ProblemOnce you change theSECRET_KEYon production, all the old sessions and cookies are invalidated,
users are logged out and data in sessions are lost.This is good if yourSECRET_KEYis compromised!
But not good if you just want to rotate in a regular schedule for security purposes.This library allows you to continue supporting old sessions signed with your old secret key,
while rewriting them with the new secret key if the user comes to the website.So optimal schedule would beyou decide to rotate your secret keyInstalldjango-rotate-secret-keyand configureSupport both keys for a limited time (x months)Roll backdjango-rotate-secret-keyand keep your secret key the same (removing the old one)If a user comes back to the website after x months, his session will be invalidated.
But for all the regular users this should be seamless transition.CompatibilityIf you are using JWT tokens created bydjango-rest-framework-jwt, currently package is not compatible. But it will
be supported in version 1.0.Getting It$ pip install django-rotate-secret-keyInstalling ItThis is safe to do even before you decide to rotate your keys,
it basically has no effect before you change the settings.:INSTALLED_APPS = (
    ...
    'rotatesecretkey',
    ...
)SettingsReplace AuthenticationMiddleware with RotateAuthenticationMiddleware:MIDDLEWARE = [
    ...
    # 'django.contrib.auth.middleware.AuthenticationMiddleware',
    'rotatesecretkey.middleware.RotateAuthenticationMiddleware',
    ...
]Replace SESSION_ENGINE:SESSION_ENGINE = 'rotatesecretkey.sessions'Add the old secret key into OLD_SECRET_KEY, and create a newSECRET_KEY.:SECRET_KEY = 'NEWRANDOMKEY'
OLD_SECRET_KEY = 'your_previous_secret_key_that_you_want_to_support'Once these changes go live your website will decode old sessions with
the OLD_SECRET_KEY and resign them with the newSECRET_KEY.After some time (like 1 or 2 months) you should roll these changes back and just keep theSECRET_KEY.:SECRET_KEY = 'NEWRANDOMKEY'You don’t want to supportOLD_SECRET_KEYforever but long enough to give your visitors a
chance to visit the website and rewrite their sessions with the new key.
Package: django-rotating-backup
Django-Rotating-BackupThis is a simple app to create rotating backups from the Django database and Media files.Quick startInstall django-rotating-backups using pip:pip install django-rotating-backupAdd "django-rotating-backups" to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'django_rotating_backup',
]Addpython manage.py create_backupto a hourly cron job.Add settings to the django settings or use environment settings. Please not that environment variables have precedent
over the settings configured in the settings.SettingsNameDescriptionDRB_BACKUP_HOURS_TO_KEEPThe number of hourly backups to keepDRB_BACKUP_DAYS_TO_KEEPThe number of daily backups to keepDRB_BACKUP_WEEKS_TO_KEEPThe number of weekly backups to keepDRB_BACKUP_MONTHS_TO_KEEPThe number of monthly backups to keepDRB_DESTINATION_FOLDERWhere to store the backupsDRB_ENABLE_SQLITE_BACKUP_COPYSet toTrueto make backup copies for SQLite databasesDRB_ENABLE_DATABASE_DUMPSSet toTrueto enable SQL dumps of databasesDRB_ENABLE_MEDIA_BACKUPSSet toTrueto enable Media folder backupsDRB_ENABLE_REMOTE_SYNCSet toTrueto enable remote sync of backup filesDRB_RSYNC_HOSTThe remote host where to sync toDRB_RSYNC_REMOTE_PATHThe path on the remote serverDRB_RSYNC_USERThe user to connect asDRB_RSYNC_PUB_KEYThe ssh public key to useExample...
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
...

# Settings for Django Rotating Backup
DRB_BACKUP_HOURS_TO_KEEP = 24
DRB_BACKUP_DAYS_TO_KEEP = 7
DRB_BACKUP_WEEKS_TO_KEEP = 4
DRB_BACKUP_MONTHS_TO_KEEP = 3

DRB_DESTINATION_FOLDER = os.path.join(BASE_DIR, 'backups')

DRB_ENABLE_SQLITE_BACKUP_COPY = True
DRB_ENABLE_DATABASE_DUMPS = True
DRB_ENABLE_MEDIA_BACKUPS = True

DRB_ENABLE_REMOTE_SYNC = True
DRB_RSYNC_HOST = '192.168.2.6'
DRB_RSYNC_REMOTE_PATH = '/home/backupuser/backup/'
DRB_RSYNC_USER = 'backupuser'
DRB_RSYNC_SSH_KEY = '/Users/backupuser/.ssh/id_rsa'
Package: django-route
Conditional url routing for djangoInstallationpip install django-routeContributingFork 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-featureSubmit a pull request :DUsageCreate a router for the urlAdd destination urlProvide the action (301/302/proxy)Describe the condition in templating languageLicenseThis project is licensed under the MIT License - see theLICENSEfile for details
Package: django-route-decorator
A flask-styleroutedecorator for django viewsSimple things should be simple, complex things should be possible (c)Alan KayThere is some contradiction between decoupling and DRY principles
in django urls. Why not use flasky@routedecorator to fix this issue?Installpip install django-route-decoratorIt's compatible with django >= 2.0 only,
because it uses newurls.pathsyntax.Simple things should be simpleJust decorate your views with an instance ofRoute:from route_decorator import Route

route = Route()

@route
def foo_view(request):
    # /foo-view

@route
def bar__view(request):
    # double underscore means a folder
    # /bar/viewAnd don't forget to add the routes into yoururls.py:from . import views

urlpatterns += views.route.patternsNow you have your views binded to/foo-viewand/bar-viewrespectively.You can also get map urlname -> url withroute.namesand pass them to
frontend maybe. In our case it would be:{
    'foo_view': '/foo-view',
    'bar__view': '/bar/view'
}Complex things should be possibleYou can passurl_prefixandname_prefixto route:route = Router('/api', 'api:')And also usepathandnamein a decorator:@route('/baz', 'baz-name')
def baz_view(request):
    ...So it would be bind to/api/bazwith nameapi:baz-name.
Package: django-routers
# django-routersDjango multiple databases, auto routers# Installpip install django-routers# UsageAdd in settings:DATABASE_ROUTERS = ['routers.router.AutoRouter']## Settings example:* Written server by **default*** Reading server by **default** and **slave**Example:DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql','NAME': 'routers','USER': 'root','PASSWORD': 'root','HOST': '127.0.0.1',},'slave': {'ENGINE': 'django.db.backends.mysql','NAME': 'routers_more','USER': 'root','PASSWORD': 'root','HOST': '10.0.0.2',}}DATABASE_ROUTERS = ['routers.router.AutoRouter']## Advanced optionsSettings Variables:* ROUTERS_READ* * Declares which server is reading* ROUTERS_WRITE* * Declares which server is written* ROUTERS_ALLOW_RELATION* * Declares whether we consulted on more than one database, default is **True**
Package: django-routeview
Django_RouteViewImplement an auto-registered viewUsageDeclare your view# views.pyfromdjango_routeviewimportRouteViewclassMyView(RouteView):route="/myurl"name="myname"# default to __name__defget(*args,**kwargs):pass...Import urls# urls.pyfromdjango.urlsimportincludeurlpatterns=[path("",include("django_routeview"))]
Package: django-royce-bulksms
Django Royce BulksmsIntegrate Bulk sms into your project in under 2 minutesQuick startInstall the packagepip install django-royce-bulksmsInstall requestspip install requestsAddroycebulksmsto your INSTALLED_APPS setting like thisINSTALLED_APPS = [
    ...
    'roycebulksms',
]Include the roycebulksms URLconf in your project urls. py like thispath('bulksms/', include('roycebulksms.urls')),Runpython manage.py migrateto create the BulkSms models.Start the development server and visithttp://127.0.0.1:8000/admin/(you'll need to be authenticated to access bulk sms UI).Visithttp://127.0.0.1:8000/bulksms/.Package setupInstall this packageOpen A free accounthereGenerate API key under API menuuse our default sender IDRoyceLtdHow to use this packageUsing User interfaceAdd Your API key and Sender Id under settings menuUnder Bulk SMS click send to phone number. Eneter your phone number to test the integrationAll SMS sent by the system(both In UI and in Views) will be under Outbox menuSending from a Viewfrom roycebulksms.views import sendText

def index(request):
    sendText('number',message,sender_id)Examplefrom roycebulksms.views import sendText

def index(request):
    
    res=sendText('0713727937','Hello from my App','RoyceLtd')For support  call/whatsapp 0713 727 937 email:developer@roycetechnologies.co.ke
Package: django-rpy2
The django_rpy2 module provides a way for developers of R scripts to design their scripts from the django administration interface and have the results be available to the django website in a predictable fashion.Features include:R Package control to import required modulesBeing able to use django’s databases, or a custom database list.Resulting output saved per-runOutput files saved into django file fields for later use.Requirements:You must have these non-python packages installed,names given here are debian package names:python-devlibcurl4-gnutls-devr-base-coreThese are required to compile the rpy2 library which acts as the R scripting core.
Package: django-rq-dashboard
Django-rq-dashboardRQis a simple task queue for queuing and processing jobs.django-rq-dashboardis a web frontend to monitor your RQ queues, jobs and
workers in realtime from the Django admin. It looks like this:See also screenshots of theWorker,QueueandJobpages.It is very much inspired from the Flask-poweredrq-dashboard.Authors: Bruno Renié andcontributorsLicence: BSDCompatibility: Django 1.4 and greater, pytz and a recent RQ (>= 0.3)Code & docs:https://github.com/brutasse/django-rq-dashboardInstallationpip installdjango-rq-dashboardAdddjango_rq_dashboardto yourINSTALLED_APPSAdd the URL patterns in you URLconf:urlpatterns = patterns('',
    (r'^admin/rq/', include('django_rq_dashboard.urls')),
    # your own patterns follow…
)(optional if non-default values) configure Redis access in your settings.
Just define a dictionnary that can be used to construct aRedisobject.
All key are optional and their default values are:RQ = {
    'host': 'localhost',
    'port': 6379,
    'db': 0,
    'password': None,
    'socket_timeout': None,
    'connection_pool': None,
    'charset': 'utf-8',
    'errors': 'strict',
    'decode_responses': False,
    'unix_socket_path': None,
}Run the development server, queue some jobs, fire off some workers and go
watchhttp://localhost:8000/admin/rq/
Package: django-rq-email-backend
RequirementsDjangoRQDjango-RQInstallationInstalldjango-rq-email-backend:pipinstalldjango-rq-email-backendAdddjango_rqtoINSTALLED_APPSinsettings.py:INSTALLED_APPS=(# other apps'django_rq_email_backend',)You must then setdjango_rq_email_backendas yourEMAIL_BACKEND:EMAIL_BACKEND = 'django_rq_email_backend.backends.RQEmailBackend'By defaultdjango-rq-email-backendwill use Django’s builtinSMTPemail backend
for the actual sending of the mail. If you’d like to use another backend, you
may set it inRQ_EMAIL_BACKENDjust like you would normally have setEMAIL_BACKENDbefore you were using RQ. In fact, the normal installation
procedure will most likely be to get your email working using only Django, then
changeEMAIL_BACKENDtoRQ_EMAIL_BACKEND, and then add the newEMAIL_BACKENDsetting from above.Inspirationdjango-rq-email-backendwas heavily influenced by:django-celery-emaildjango-rq-mail
Package: django-rq-jobs
Provides scheduled jobs management from the Django Admin usingDjango-RQAdmin ScreenshotRequirementsDjangoDjango-RQArrowInstallationMake sure you haveDjango-RQup
and running before you do anything. This app is just a simple admin
plugin to manage your scheduled tasks and management commands.Install the package withpip installdjango-rq-jobsAdddjango_rq_jobsto INSTALLED_APPS in settings.py:INSTALLED_APPS=(# other apps"django_rq","django_rq_jobs",)AddRQ_JOBS_MODULEin settings.py. A string or a tuple of strings
designating all modules where you keep your jobs. Anything marked
with the Django RQ’s@jobdecorator will show up in the admin.# A singe module:RQ_JOBS_MODULE='myapp.tasks'# or with multiple modules:RQ_JOBS_MODULE=('myapp.tasks','anotherapp.tasks',)Runpython manage.py migrateto create the job model.Open your Django admin and find the RQ Jobs scheduled job section and
schedule something.Schedule the heartbeatpython manage.py rqjobswith your favorite
scheduler. This can be cron, Heroku scheduler or anything else you
prefer. Make sure you set the heartbeat interval to something
sensible; 5 or 10 minutes is usually enough, but run it every minute
if you want. Execution of the jobs is deferred to RQ anyway.NotesSupports once, hourly, daily, weekly, monthly, quarterly and yearly
scheduled tasks.Limited run schedules: Set the ‘Repeats’ on a task to the maxium
number of repeats you want. The task gets deleted once the counter
reaches zero. Defaults to-1for eternal.Arguments are a dict:{'one': 1, 'two': 2, 'three': 3}RQ Jobs will try to link a job to a queue task status in Django RQ.
Usually these job reports don’t exist much longer than a few minutes
unless they fail. So if you are seeingNonein the RQ status,
that usually means things went well.If you haven’t run the heartbeatmanage.py rqjobsfor a while and
missed some scheduled jobs, RQ Jobs will play catch-up with every
heartbeat. This way limited run schedules don’t get compromised.Scheduling Management CommandsIf you want to schedule regular Django management commands, it’s easiest
to add them using Django’s management wrapper. So if you wanted to
schedule `manage.py clearsessions’ :fromdjango.coreimportmanagement@jobdefclear_sessions():returnmanagement.call_command('clearsessions')This will automagically appear as ‘Clear Sessions’ in the admin
interface.AcknowledgementsImpossible without the excellentDjango-RQandRQprojects. Thanks toArrowfor making dates easy.
Package: django-rql-filter
This app implements a RQL/RSQL/FIQL filter backend fordjango-rest-frameworkand
enables passing arbitrary conditional expressions to filter entities.Installationpipinstalldjango-rql-filterUsageAddrql_filterto your projectINSTALLED_APPS.Add theRQLFilterBackendto your viewsetfilter_backends:fromrql_filter.backendimportRQLFilterBackendclassThingyViewSet(viewsets.ReadOnlyModelViewSet):filter_backends=(...RQLFilterBackend,...)You may now pass a RQL/RSQL/FIQL query to API URLs using theqquerystring parameter:curlhttp://my.app/api/thingies/?format=json&q=name==bob;age=gt=30Query syntaxA query is made using a combination of field comparisons. Comparisons
are composed by a field name, an operator and a value.OperatorMeaningExamples==Equal toname==bob!=Not equal toname!=bob<=lt=Less thanage<30age=lt=30<==le=Less than or equal toage<=30age=le=30>=gt=Greater thanage>30age=gt=30>==ge=Greater than or equal toage>=30age=ge=30=in=Belongs to setname=in=(bob,kate)=out=Does not belong to setname=out=(bob,kate)Comparisons can traverse model relations by separating field names with
a double underscore:father__name==bob.Values must be quoted with single or double quotes when they include
special characters or spaces:name=="bobkatz".Comparisons may be combined using logical operators:;for a logical
AND, and,for a logical OR:name=="bob";age>=30. AND has
priority over OR; grouping is available using parentheses:name=="bob";(age>=30,age<3).Note:RQL/RSQL/FIQL support is still incomplete, it will be enhanced
over time.ConfigurationRQL_FILTER_QUERY_PARAMsets the querystring parameter name to use;
it defaults to'q'.Using without rest-frameworkYou may use the backend manually outside a rest-framework viewset:fromrql_filter.backendimportRQLFilterBackend# May be reused any number of timesbackend=RQLFilterBackend()# Fake request objectclassFakeRQLRequest:def__init__(self,q):self.GET={'q':q}qs=Thingy.objects.all()filtered_qs=backend.filter_queryset(FakeRQLRequest('name==bob;age=gt=30'),qs,None)TestingInstall testing dependencies:pipinstall-e.[testing]Run tests:py.test
Package: django-rq-pulse
A Django package to check that rq workers are running and notify admins if they are notQuickstartInstall Django RQ Pulse:pip install django-rq-pulseAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'django_rq_pulse.apps.DjangoRqPulseConfig',...)Define theSERVER_EMAILandADMINSDjango settings because these settings will be used to send notification emails.Define a dictionary in your Django settings for your Redis connection details like so:REDIS_DB = {
    'host': 'Your Redis Hostname or IP goes here',
    'port': 'Your Redis port number goes here',
    'database': 'Your Redis database number goes here'
}UsageCheck that rqworkers are running:$ python manage.py rq_pulse_checkIf the actual number of workers is less the expected number of workers or
If there are items in the queue but the queue size is not changing notify admins by email.The above command will run with default parameters where:--expected-num-workers=2
--seconds-to-sleep=5
--num-retries=5
--queue-name="default"You can override these values by passing any or all the parameters to the command like so:$ python manage.py rq_pulse_check --expected-num-workers=3 --queue-name="high"To get a list of the command parameters use the –help parameter:$ python manage.py rq_pulse_check --helpRunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.2.0 (2019-07-23)Change behaviour of –expected-num-workers to only report to admins when the number of workers are less than the expected value. Add test versions for Python 3.6 and Django 2.2.0.1.4 (2018-02-13)Use the built in mail_admins Django function instead of send_mail.0.1.3 (2018-02-12)Add commands to Makefile to simplify the package build and release process.0.1.2 (2018-02-12)Modify setup.py to enable the usage of bumpversion.0.1.1 (2018-02-12)Allow the Redis connection details to be customizable.0.1.0 (2018-01-19)First release on PyPI.
Package: django-rq-wrapper
# django_rq_wrapperDjango management command for multiple rq workers in one command and autoreload.—This project builds off of [Django RQ](https://github.com/ui/django-rq). Instead of using the commandpython manage.py rqworker high default low, you can now runpython manage.py rqworkers high default low.### Installationpip install django-rq-wrapperAdddjango_rq_wrapperto your installed apps. Use the management commandrqworkers.### Added command options:If you need to run multiple workers, you can pass in the--workersflag with the
number of workers you want to spawn. If you don’t pass in this flag, the number of
workers will default to the environment variableRQ_CONCURRENCY, or 1 if that
is not set:python manage.py rqworkers high default low --workers 5If you would like to have your workers autoreload the same way django’s runserver
autoreloads, use the--autoreloadflag:python manage.py rqworkers high default low --autoreload### Note for HerokuAdd the environment variableRQ_CONCURRENCYto your config with the number of workers
appropriate for (your dyno type)[https://devcenter.heroku.com/articles/optimizing-dyno-usage#python].
Package: django-rrweb
Django Rrwebis an Apache2
licensed Django application that records and replays sessions in web browsers.FeaturesRecord sessions in web browsersReplay sessions in web browsersTested on Python 3.7, 3.8, 3.9, 3.10Tested on Django 3.2 LTS and Django 4.0QuickstartInstalling Django Rrweb is simple withpip:$ pip install django-rrwebChangesettings.pylike:INSTALLED_APPS += ['django.contrib.humanize', 'django_rrweb']Changeurls.pylike:urlpatterns += [path('backend/', include('django_rrweb.urls'))]The Django “admin” is also required for replaying and deleting sessions.Then migrate the database like:$ python manage.py migrateReference and IndicesDjango Rrweb DocumentationDjango Rrweb at PyPIDjango Rrweb at GitHubDjango Rrweb Issue TrackerDjango Rrweb LicenseCopyright 2022 Grant JenksLicensed under the Apache License, Version 2.0 (the “License”); you may not use
this file except in compliance with the License.  You may obtain a copy of the
License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.  See the License for the
specific language governing permissions and limitations under the License.