Saravanan666/pypi-org huggingface dataset:
Package: wsgiauth0
This is an Auth0 middleware for multiple client configurations.It adds 4 keys toenvironmapping:wsgiauth0.jwt_claims: The decoded claims dict orNoneif any error
occurred. Example:{
    'iss': 'issuer',
    'sub': 'auth0|user_id',
    'aud': 'https://example.com,
    'exp': 1234567890,
    'iat': 1134567890,
}wsgiauth0.jwt_error: A mapping with keyscodeanddescriptionorNoneif no error occurred, Example:{
    'code': 'invalid_header',
    'description': 'Authorization header must be "Bearer token".',
}wsgiauth0.jwt_client: A mapping with the client info used if any info were
successfully deduced from json web token received:{
    'id': 'NieY4eekoo3aed2fe9ei',
    'audience': 'https://example.com',
    'secret': 'shei6eehuF2ui9OphahW',
}REMOTE_USER: The decoded subject fromwsgiauth0.jwt_claimsorNoneif
any error occurred.UsageConfigure your wsgi pipeline in paste deploy ini file:[filter:wsgiauth0]
use = egg:wsgiauth0#middleware
clients_config_file = %(here)s/auth0_clients_config.yml

[pipeline:main]
pipeline =
    wsgiauth0
    myapp

[app:myapp]
use = egg:wsgiapp#main

[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543Configuration with DynamoDBIt expects aclients_config_filekey pointing to auth0 client configuration
yaml file.Here is an example of a yaml configuration file.Client 1:id:oZ0ahm4Thoh1Oghiqu4oe9quaudience:oZ0ahm4Thoh1Oghiqu4oe9qusecret:value:noh4feibaighikeeD0inah9Rei3nei6yeenoa7uar2Dah2yaeKioph8Jux8ahtetype:base64_url_encodedClient 2:id:Aen1XobahDoh7queing3eaS0@clientsaudience:https://example.com/secret:value:|-----BEGIN CERTIFICATE REQUEST-----MIIBZjCB0AIBADANMQswCQYDVQQGEwJDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAx2LwsUexPKQ/0GIHqugXZtIGZxSOovO754KWn3ZWBbDvm/wuh+QfmMj8ZTxnxRymHjSNJ04nCMcqtzl3VDwapMkM433CnyZjoJjA/fRwLRjUepLAMbmoqkOGk1BKNAyidyko7DBnkMayzJRfmnCwFy1hsuikh6oFSinU7MP3LBsCAwEAAaAaMBgGCSqGSIb3DQEJBzELEwljaGFsbGVuZ2UwDQYJKoZIhvcNAQELBQADgYEAP819zy3q1gh5z5FLeFanc3TpdlcGHCQxcTMC/x9iyMpbSd2XkKLrZ02Is1Y8Ox/XeT8zNjOg/nulPg6YrIsywpKFR4orMvuUUMZ8uT8UVNj1pnatmXy9ikjdGtBXeU+EKkMZ4q6aOrG8qyB4o/WETphyxfneazWt3jrLHkKBvXA=-----END CERTIFICATE REQUEST-----type:certiticateConfiguration with DynamoDBDynamoDB can be used as a configuration source.  The configuration
table should have an item for each key that should be used for
authentication.Specify the table name with theclients_config_tablekey, and the
service name withclients_config_service.The table should have a hash key on theservicefield, and a sort
key on thelabelfield (a human friendly description for the key).
The other fields areid,audience,and secretwith sub-keystypeandvalue.You should require thedynamodbextra dependency
(i.e. wsgiauth0[dynamodb]).
Package: wsgi-aws-unproxy
Set the correctREMOTE_ADDRbased on theX-Forwarded-Forheader,
while only trusting the CloudFront IP addresses.This module is applied as WSGI middleware, fixing the IP-address retrieval for the entire application in a secure manner.
As extra benefit, external packages no longer have to write abstraction layers to retrieve the IP-address header.Django exampleIn Django edit thewsgi.pyfile to apply the module:fromdjango.core.wsgiimportget_wsgi_applicationfromwsgi_aws_unproxyimportUnProxyapplication=get_wsgi_application()application=UnProxy(application)Now all packages can just readrequest.META['REMOTE_ADDR']to fetch the correct IP.
This includes contact forms, Sentry error reporting and rate limiting tools.InstallationYou can install the latest version using pip:pipinstallwsgi-aws-unproxyAnd apply it as WSGI middleware:fromwsgi_aws_unproxyimportUnProxyapplication=UnProxy(application)
Package: wsgi-basic-auth
Really simple wsgi middleware to provide basic http auth. It is intented to
work with environment variables. This makes it simple to use in a docker
context.StatusGetting startedUsing this module is really simple.  In Django for example edit the wsgi.py
file and add the following to the end of the file.fromwsgi_basic_authimportBasicAuthapplication=BasicAuth(application)Now run docker with the env variable WSGI_AUTH_CREDENTIALS=foo:bar and you have
to authenticate with username foo and password bar. Multiple credentials are
separated with a | (pipe) character.To exclude specific paths for healthchecks (e.g. the Amazon ELB healthchecks)
specify the environment variable WSGI_AUTH_EXCLUDE_PATHS=/api/healthchecks.
Here multiple paths can be separated with the ; char.To include only specific paths specify the environment variable
WSGI_AUTH_EXCLUDE_PATHS. Here multiple paths can be separated with the ; char.You can use both include and exclude paths together for example:
WSGI_AUTH_PATHS=/foo
WSGI_AUTH_EXCLUDE_PATHS=/foo/bar
This will force Basic Auth on all paths under /foo except /foo/barInstallationYou can install the latest version using pip:pip install wsgi-basic-auth
Package: wsgi-basic-auth-isl
Really simple wsgi middleware to provide basic http auth. It is intented to
work with environment variables. This makes it simple to use in a docker
context.StatusGetting startedUsing this module is really simple.  In Django for example edit the wsgi.py
file and add the following to the end of the file.fromwsgi_basic_authimportBasicAuthapplication=BasicAuth(application)Now run docker with the env variable WSGI_AUTH_CREDENTIALS=foo:bar and you have
to authenticate with username foo and password bar. Multiple credentials are
separated with a | (pipe) character.To exclude specific paths for healthchecks (e.g. the Amazon ELB healthchecks)
specify the environment variable WSGI_AUTH_EXCLUDE_PATHS=/api/healthchecks.
Here multiple paths can be separated with the ; char.To include only specific paths specify the environment variable
WSGI_AUTH_EXCLUDE_PATHS. Here multiple paths can be separated with the ; char.You can use both include and exclude paths together for example:
WSGI_AUTH_INCLUDE_PATHS=/foo
WSGI_AUTH_EXCLUDE_PATHS=/foo/bar
This will force Basic Auth on all paths under /foo except /foo/barInstallationYou can install the latest version using pip:pip install wsgi-basic-auth
Package: wsgi_cache
Date:2010-01-05Authors:Nathan R. Yergler <nathan@yergler.net>Copyright:2010, Nathan R. Yergler, Creative Commons;
licensed to the public under the MIT License.wsgi_cacheis a piece of WSGI middleware that provides disk
caching for WSGI applications.  It is somewhat coarse and rather
inflexible, sort of like your grandpa.wsgi_cacheis designed to cache requests to a WSGI site to disk in
a cache directory on disk.  The cache directory will have the same
directory layout as the requests (ie, if/foo/baris requested, thefoodirectory will be made in the cache andbarwill be stored
there).  There isnocache expiration beyond deleting cached files
from the disk.  This is a feature.Installationwsgi_cachecan be installed as a Python egg, using easy_install:$ easy_install wsgi_cacheConfigurationConfiguration of wsgi_cache will often be done using Paste Deploy.  In
this situation, it can be configured as a filter:[app:main]
use = egg:my_wsgi_app#app
filter-with = cache

[filter:cache]
use = egg:wsgi_cache#middleware
cache_dir = ./cacheThecache_diris the only required configuration parameter, and
will be interpreted as relative toglobal_conf['here'].wsgi_cachealso supports three additional configuration parameters:content_typeSpecifies the content type used when serving cached resources; seeLimitationsbelow for details on this.  By default this is set totext/html.cache_pathsA comma separated list of paths, starting with a/, that
specifies the paths to cache.  If specified, only requests to
paths starting with one of these strings will be cached.directory_indexWhen accessing a path that ends in a/(like/monkeys/),
wsgi_cache needs to create a special filename.  By default this is__index.html.  So by default, caching the page/monkeys/saves to the file${path_to_cache}/monkeys/__index.html; if we
set directory_index todir_xit would save to${path_to_cache}/monkeys/dirx.BehaviorWhen a request comes in,wsgi_cacheexamines the path to determine
if it should be cached.  Requests with a querystring arenotcached, regardless of the use ofcache_paths.  If the request is
supposed to be cached,wsgi_cachelooks for the page in the cache
and serves that copy, if available.  If unavailable, the request is
passed to the application and the result is saved and returned.Note that in many situations, you’ll want to exploitwsgi_cache’s
on disk cache layout to serve the cached version directly using your
front end web server (ie, Apache with mod_rewrite).Developmentwsgi_cachemay be developed usingbuildout$ python bootstrap.py
$ ./bin/buildoutThis will install any dependencies, as well as create a wrapperpythonscript that can be used to run a shell withwsgi_cacheon the Python path.Running Testswsgi_cacheusesnosefor running tests.  You can run the test
suite by running:$ python setup.py nosetestsIf you’re using buildout for development, nose will be installed in
the buildout for you:$ ./bin/python setup.py nosetestsLimitationswsgi_cacheonly stores the response body in order to allow
serving of the cached files by a faster, static webserver.  As such,
it can only return a single content-type at this point.Download
Package: wsgi_chronometer
WSGI middleware for chronometer wsgi applicationUsageYou can use in your wsgi app :from wsgi_chronometer import ChronoFilter
from somewhere import SomeWsgiApp

return ChronoFilter(SomeWsgiApp,  **{'separator': '*', 'fields': ['DATETIME', 'TIME']})(environ, start_response)or in the .ini deployement file :[app:sample]
use = egg:sample_app

[pipeline:main]
pipeline =
   chrono
   sample

[filter:chrono]
use = egg:wsgi_chronometer
separator = -
fields = REQUEST_METHOD PATH_INFO HTTP_USER_AGENT HTTP_X_FORWARDED_FOR HTTP_X_REAL_IP
Package: wsgicli
Command Line Interface for developing WSGI application.
This library has following features.Run WSGI Application in wsgirefRun wsgi application with specified host and port.Serving Static files.Live reloading.line by line profiling.Validating your WSGI application complying with PEP3333 compliance.Run python interpreterSupported interpreters are python(plain), ipython, bpython, ptpython and ptipython.Automatically import SQLAlchemy and peewee models when run the interpreter.CommandsRun commandSynopsis$wsgiclirun[FILEPATH][WSGIAPP][Options]NoArgumentsEnvironment VariableDescription1FILEPATHWSGICLI_FILEThe file path for your WSGI application.2WSGIAPPWSGICLI_WSGI_APPThe variable name of your wsgi application object.OptionsEnvironment VariableDefaultDescription-h--hostWSGICLI_HOST127.0.0.1The hostname to bind to.-p--portWSGICLI_PORT8000The port to bind to.--reload/--no-reloadWSGICLI_RELOADFalseEnable live reloading.--intervalWSGICLI_INTERVAL1Interval time to check file changed for reloading (sec).--static/--no-staticWSGICLI_STATICFalseEnable static file serving.--static-rootWSGICLI_STATIC_ROOT/static/URL path to static files.--static-dirsWSGICLI_STATIC_DIRS['./static/']Directories to static files (multiple).--lineprof/--no-lineprofWSGICLI_LINEPROFFalseEnable line profiler.--lineprof-fileWSGICLI_LINEPROF_FILEWSGIAPP(2nd arg)The filename profiled by line-profiler.--validate/--no-validateWSGICLI_VALIDATEFalseValidating your WSGI application complying with PEP3333.--helpShow help text.Example$wsgiclirunmain.pyapp-p8080--reloadShell commandSynopsis$wsgiclishell[FILEPATH][WSGIAPP][Options]NoArgumentsEnvironment VariableDescription1FILEPATHWSGICLI_FILE_PATHThe file path for your WSGI application.2WSGIAPPWSGICLI_WSGI_APPThe variable name of your wsgi application object.OptionsEnvironment VariableDefaultDescription-i--interpreterWSGICLI_INTERPRETER'python'Supported interpreters are ipython, bpython, ptpython and ptipython.--models/--no-modelsWSGICLI_MODELSTrueAutomatically import ORM table definition from your app.--helpShow help text.Example$wsgiclishellmain.pyapp--interpreteripythonRequirementsPython 3.3 or laterclickwsgi-static-middlewarewsgi-lineprofLicenseThis software is licensed under the MIT License.
Package: wsgi-cloudflare-proxy-fix
wsgi_cloudflare_proxy_fixis a WSGI middleware that safely sets theREMOTE_ADDRenvironment variable to the value of theCf-Connecting-Ipheader for requests originating from Cloudflare.In addition, it sets aCF_TRUSTEDenvironment variable toTruefor
all requests originating from Cloudflare.InstallationInstallwsgi_cloudflare_proxy_fixusingpip:pip install wsgi_cloudflare_proxy_fixUsageThe following examples assumewerkzeug.middleware.proxy_fix.ProxyFixis
being used to read theX-Forwarded-ForandX-Forwarded-Protoheaders.For a standalone WSGI application:importloggingfromwsgi_cloudflare_proxy_fiximportCloudflareProxyFixfromwerkzeug.middleware.proxy_fiximportProxyFixapplication=CloudflareProxyFix(application,log_level=logging.INFO)application=ProxyFix(application)For a Flask application:importloggingfromwsgi_cloudflare_proxy_fiximportCloudflareProxyFixfromwerkzeug.middleware.proxy_fiximportProxyFixdefcreate_app():app=Flask(__name__)app.wsgi_app=CloudflareProxyFix(app.wsgi_app,log_level=logging.INFO)app.wsgi_app=ProxyFix(app.wsgi_app)returnappTestingTo verify the proxy fix is working as expected in your production environment,
theCloudflareProxyFixTestmiddleware can be used by adding the following
to your application:importloggingfromwsgi_cloudflare_proxy_fiximportCloudflareProxyFix,CloudflareProxyFixTestfromwerkzeug.middleware.proxy_fiximportProxyFixdefcreate_app():app=Flask(__name__)app.wsig_app=CloudflareProxyFixTest(app.wsgi_app,path="/debug/cf-test")app.wsgi_app=CloudflareProxyFix(app.wsgi_app,log_level=logging.INFO)app.wsgi_app=ProxyFix(app.wsgi_app)returnappAnd making a request to thedebug/cf-testendpoint:$ curl http://localhost:5000/debug/cf-test
{
    "CF_TRUSTED": null,
    "REMOTE_ADDR": "127.0.0.1"
    "wsgi_cloudflare_proxy_fix.orig": null,
}
$ curl -H 'X-Forwarded-For: 103.31.4.1' -H 'Cf-Connecting-Ip: 1.2.3.4' http://localhost:5000/debug/cf-test
{
    "CF_TRUSTED": true,
    "REMOTE_ADDR": "1.2.3.4",
    "wsgi_cloudflare_proxy_fix.orig": {
        "REMOTE_ADDR": "103.31.4.1"
    }
}
Package: wsgi_cors_middleware
Cross Origin Resource Sharing (CORS) Middleware for WSGI Applications.UsageUse theCorsMiddlewarefromwsgi_cors_middleware.fromwsgi_cors_middlewareimportCorsMiddlewareapplication=CorsMiddleware(application,origin='*',methods=['POST','PUT'],headers=['Content-Type','Authorization'])Optionsorigin: URI that may access this applicationcredentials: indicates that the request can be made using credentialsheaders: list of headers that may be used when accessing this applicationmethods: list of methods allowed to access this applicationexpose_headers: list of headers to be exposed to the browsermax_age: number of seconds a preflight request may be cached
Package: wsgidav-bcryptdc
wsgidav-bcryptdcAn implementation of thewsgidavsimple-dc that uses bcrypt hashes instead of plain text passwords.InstallationInstall bcrypt dependency (requires rust to be present, if i'm not mistaken)$pipinstallwsgidav-bcryptdcConfigurationConfiguration is basically the same as for thesimple-dc, with the exception that it uses thebcrypt_dcconfig key, and apassword_hashproperty is used instead ofpassword.# NOTE: only HTTP basic auth is supported, make sure your communication to the wsgidav service is using SSL encryptionhttp_authenticator:domain_controller:wsgidavbcryptdc.SimpleBcryptDomainControlleraccept_basic:trueaccept_digest:falsedefault_to_digest:falsebcrypt_dc:user_mapping:'*':# default user mapping for all shares'username':password_hash:'$2y$05$u5fxm.Fb0sW64j6bFLFoKuTki0/ZSymNSlEBFR03SHngCZBA56XIS'# bcrypt hash for 'top-secret'roles:['admin']
Package: wsgi-design
1) installpython32) git clone git://github.com/gertcuykens/wsgi-design.git3) python3 server.py and go to indexpageAll the examples are sending json objects, no html is being generated by the server. Pleas take a look at the source code and consider this technique in your future projects.client requestCookie: bac0c1f9a9362f9e{“cmd”:”order”,“sid”:”bac0c1f9a9362f9e”,“input”:”…”}server responseSet-Cookie: bac0c1f9a9362f9e{“uid”:”gert”,“gid”:”admin”,“output”:”…”}
Package: wsgi-django-media
Really simple wsgi middleware to serve media files before hitting the Django
app. Only enabled when Django DEBUG is True. This can really speed up your
local development process when a page loads a lot of media files.StatusGetting startedUsing this module is really simple.  In Django for example edit the wsgi.py
file and add the following to the end of the file.fromwsgi_django_mediaimportDjangoMediaapplication=DjangoMedia(application)InstallationYou can install the latest version using pip:pip install wsgi-django-media
Package: wsgi-echo-server
wsgi-echo-serverA wsgi and http echo server.How to usepipinstallwsgi-echo-server# Running with wsgi socketUWSGI_SOCKET=:9000uwsgi--modulewsgi_echo_server# Running with http socketUWSGI_HTTP_SOCKET=:9001uwsgi--modulewsgi_echo_server# Running with wsgi and http socketUWSGI_SOCKET=:9000UWSGI_HTTP_SOCKET=:9001uwsgi--modulewsgi_echo_serverThere is a docker image ready to use:dockerrun-e"UWSGI_SOCKET=:9000"ghcr.io/buserbrasil/wsgi-echo-serverResponse{
    "environment": {
        "PATH_INFO": "/",
        "QUERY_STRING": "",
        "RAW_URI": "/",
        "REMOTE_ADDR": "127.0.0.1",
        "REQUEST_METHOD": "GET",
        "REQUEST_URI": "/",
        "SCRIPT_NAME": "",
        "SERVER_NAME": "localhost",
        "SERVER_PORT": "80",
        "SERVER_PROTOCOL": "HTTP/1.1"
    },
    "host": {
        "hostname": "mockedhostname"
    },
    "http": {
        "method": "GET"
    },
    "request": {
        "body": "",
        "cookies": {},
        "headers": {
            "host": "localhost",
            "user-agent": "werkzeug/2.2.3"
        },
        "query": {}
    }
}
Package: wsgiform
WSGI middleware for validating form submissions and parsing them into dictionaries, individual WSGI ‘environ’ dictionary entries, cgi.FieldStorage  instances, or keyword arguments passed to a WSGI application. Supports automatically escaping and sterilizing form submissions.Simple wsgiform usage format example:from wsgiform import form

@form()
def app(environ, start_response):
    return environ['wsgiform.dict']['name']
Package: wsgifront
Thewsgifrontmodule is a simple layer that lets you connect yourWSGIapplication to any type of server.
Your WSGI application always receives a consistent environment, regardless of the
specific type of server you are using on the front-end. This behavior helps a developer to ensure their
code remains server-independent by not relying on server-specific headers, etc.
Numerous recipes are included to give you a quick start for deploying your application.Adapters are currently included for:mod_pythonCGIPHP (with Python installed anywhere on the host system)Google AppEngineCherryPy using either:Full application serverStandalone WSGI serverwsgiref.simple_serverYou’ll notice that some of these servers already provide a
WSGI-like environment. In those cases wsgifront simply
normalizes the environment and passes through the requests.These adapters are intentionally kept as minimal as possible. Although wsgifront contains sample
middleware for URL dispatching, sessions, and error handling, these are completely optional.wsgifrontsimply provides the server-side adapters and stays out of your way otherwise.
Package: wsgigo
What is it?WSGI go is a very simple WSGI router with no requirements. It is written for Python 3, though it could be
easily backported.Installationpip install wsgigoUsageYou can use it to route WSGI requests to specific apps based on hostname, URL fragment, or (through extending the
Route class) other criteria. For example, suppose you have three wsgi apps which you want to serve as one:from wsgigo import AppRouter

app = AppRouter(default_app=main_website)
app.add_startswith(docs_app, '/docs/')
app.add_hostname(api_app, 'api.local')
app.add_regexp(animal_app, '/(?:monkey|ape)/')You can also make your own router class, to route apps how you need them to be routed:class InternetExplorerRouter(Route):
    def claim(self, environ):
        user_agent = environ['HTTP_USER_AGENT']
        if 'Trident/7.0' in user_agent or 'MSIE' in user_agent:
            return True

internet_explorer_app = TestWsgiApp("<b>really simple webpage</b>")
real_app = TestWsgiApp("<b>really ADVANCED webpage</b>")

router = AppRouter(default_app=real_app)
router.add_route(InternetExplorerRouter(internet_explorer_app))
Package: wsgi_graphql
Create a WSGI Application for a GraphQL schema.UsageUse theGraphQLApplicationfromwsgi_graphql.fromwsgi_graphqlimportGraphQLApplicationapplication=GraphQLApplication(schema)Optionsschema:GraphQLSchemato serve with this application.execute_options: Dictionary of options to be passed tographql.executeviagraphql_server.run_http_query. If the dictionary values are callable
they will be called (see example below).format_error: Function to format errors (defaults tographql_server.default_format_error).encode: Function to encode dictionary (defaults tographql_server.json_encode).Allexecute_optionscan becallable(i.e. functions) and will receive
the currentenvironas an argument. This can be used for tasks like parsing
authentication tokens and inserting results ascontext_value.This snippet from theexample.pysets thecontext_valueto a dictionary
containing the value of the request headergreet.application=GraphQLApplication(schema,execute_options={'context_value':lambdaenviron:{'greet':environ.get('HTTP_GREET')}})Thiscurlcommand will return{"data":{"hello":"world"}}.curl--requestPOST\--urlhttp://localhost:8080\--header'Content-Type: application/graphql'\--header'greet: world'\--data'query {hello}'
Package: wsgigzip
Usage example:from wsgigzip import gzip

@gzip()
def index(environ, start_response):
    start_response('200 OK', [('Content-type', 'text/plain')])
    return ['Home Page']

if __name__ == '__main__':
    from wsgiref.simple_server import make_server
    http = make_server('', 8080, index)
    http.serve_forever()