Saravanan666/pypi-org huggingface dataset:
Package: bottle-restx
Bottle RESTXA simple resource based REST API extension for the bottle framework. Loosely inspired by flask-restx.InstallationViapip$pipinstallbottle-restxQuickstartThe syntax is class based. Create anAPIobject, which is a subclass ofbottle.Bottle. For every resource add a subclass of theResourceclass and decorate it with theAPI.routedecorator. The route is passed to the method fitting the HTTP method.frombottle_restximportAPI,Resourceapi=API()@api.route("/my/route/<id>")classMyResource(Resource):defget(id):...defpost(id):...defput(id):...defdelete(id):...The individual methods are not mandatory. You might actually discard unwanted methods. By default they produce an 405 (Method not allowed).
Package: bottle-servefiles
Overviewbottle-servefilescan serve static files for your bottle.py application.I deceided to create this application to further my understanding
of WSGI and how to build pluggable apps for the bottle.py ecosystem.bottle-servefiles aims to be a simple WSGI app that can be mounted into any
bottle.py powered app in order to serve static files from any url.For instance in a regualar bottle.py app you may have the code below
to serve static files:from bottle import route
import bottle

...

@route('/static/:filename#.*#')
def static(filename):
    bottle.static_file(filename, root=...)What I would like is to be able to mount a reusable static file handler
on any path I chose within my application, without having to explicitly
attach the path to the handler definition.Ok I know that is pure nonsense but I had to come up with a compelling
reason to build this thing in the first place.So moving swiftly forward, with a static handler implemented as a
pluggable bottle app, I would be able to do the following:import bottle

...

myapp = bottle.default_app()
myapp.mount(bottle.load_app('servefiles'), '/media')
bottle.run(app=myapp)It doesn’t look like much, but with a pluggable app, it now becomes
possible to configure the application (e.g. set the “root” directory)
per mounted instance of the static file handler!FeaturesTODOInstallationYou can install upgrade or uninstall bottle-servefiles with these commands:> pip install bottle-servefiles
> pip install -U bottle-servefiles
> pip uninstall bottle-servefilesIf you do not have pip you may use easy install:> easy_install bottle-servefilesIf you do not have easy_install, you may download the piot
source distribution archive. Extract it and run:> python setup.py installExample usageThis is a basic outline of how you would use bottle-servefiles
to server static files from your application.Create an application module “app.py” with the contents:import bottle


class MySite(object):
    def __init__(self, app=None):
        self.app = app if app else bottle.default_app()

    def __call__(self, environ, start_response):
        return self.app(environ, start_response)


if __name__ == '__main__':
    mysite = MySite()
    mysite.app.mount(bottle.load_app('servefiles'), '/__media')
    bottle.debug(True)
    bottle.run(app=foo, reloader=True)Copyright (c) 2011 - Rudy Lattae. Released under the New BSD License.Changelog
Package: bottle-sipper
Sipper is a simple, zero-configuration command-line static HTTP server. It is built on bottle:https://github.com/bottlepy/bottle|https://bottlepy.org/docs/dev/It aims to provide the same value provided by
http-server tool written in nodejs:https://github.com/http-party/http-server|https://www.npmjs.com/package/http-serverHomepage and documentation:https://github.com/leogps/bottle-sipperCopyright (c) 2023, Paul Gundarapu. License: MIT (see LICENSE for details)
Package: bottle-sql
BottleSQLSQL plugin for Bottle. Supports MySQL/MariaDB and SQLite.InstallationPyPipipinstallpipinstallbottle-sql==0.0.1Sourcewgethttps://raw.githubusercontent.com/thepure12/bottle-sql/main/src/bottle_sql/bottle_sql.pyUsageSQLfrombottleimportBottlefrombottle_sqlimportsqlPluginapp=Bottle()user,pw,host,db=("root","","localhost","mydb")sql_plugin=sqlPlugin(user=user,password=pw,host=host,database=db)app.install(sql_plugin)SQLitefrombottleimportBottlefrombottle_sqlimportsqlitePluginapp=Bottle()dbfile=":memory:"sql_plugin=sqlitePlugin(dbfile)app.install(sql_plugin)
Package: bottle-sqlite
Bottle-sqlite is a plugin that integrates SQLite3 with your Bottle
application. It automatically connects to a database at the beginning of a
request, passes the database handle to the route callback and closes the
connection afterwards.To automatically detect routes that need a database connection, the plugin
searches for route callbacks that require adbkeyword argument
(configurable) and skips routes that do not. This removes any overhead for
routes that don’t need a database connection.Usage Example:import bottle
from bottle.ext import sqlite

app = bottle.Bottle()
plugin = sqlite.Plugin(dbfile='/tmp/test.db')
app.install(plugin)

@app.route('/show/:item')
def show(item, db):
    row = db.execute('SELECT * from items where name=?', item).fetchone()
    if row:
        return template('showitem', page=row)
    return HTTPError(404, "Page not found")
Package: bottle-streamline
This project is a collection of classes for writing complex, modullar, and/or
reusable route handlers usingbottleweb framework.Even though ‘complex route handlers’ may seem like an oximoron, there may be
situations where support for multiple parameters are needed or where a simple
branching in the route handler code may completely change the logic of your
route handler. If you find yourself running into this type of situation and
struggle to organize the code, you may find bottle-streamline is a good fit for
your project.Quick exampleExample of a classic Hello world app:import bottle
from streamline import RouteBase


class Hello(BaseRoute):
    def get(self):
        return 'Hello world!'


Hello.route('/')
bottle.run()DocumentationYou will find the complete documentation and tutorialson ReadTheDocs.
Package: bottle-suite
Bottle SuiteBottle.py suite with CORS, SQL, REST, and JWTInstallationpython3-mpipinstall--index-urlhttps://test.pypi.org/simple/--extra-index-urlhttps://pypi.org/simple/bottle-suite--upgradeUsageCLICreate Project$bottle-suite-create
Enterprojectname.<bottle-suite-project>:
CreateaSQLitedatabase?[y/N]:
AttachanSQLdatabase?[y/N]:
Createdprojectbottle-suite-projectcdbottle-suite-projectbottle-suite-d-rRun$cdbottle-suite-project
$bottle-suite-d-r
Viewdashboard@http://localhost:8000/dashboard
Bottlev0.13-devserverstartingup(usingWSGIRefServer(dashboard=True))...
Listeningonhttp://localhost:8000/
HitCtrl-Ctoquit.Optionsusage: bottle-suite [-h] [--port PORT] [--host HOST] [--jwt JWT_KEY] [--sqlite [PATH]] [--dbhost DBHOST] [--dbname DBNAME] [--dbuser DBUSER] [--dbpass DBPASS] [--cors CORS] [-r] [-d]

optional arguments:
  -h, --help       show this help message and exit
  --port PORT      Port to listen on
  --host HOST      Host to listen on
  --jwt JWT_KEY    JWT key
  --sqlite [PATH]  Path to SQLite database (default: bottle-suite/src/scripts/tmp.db)
  --dbhost DBHOST  SQL database host
  --dbname DBNAME  SQL database name
  --dbuser DBUSER  SQL database username
  --dbpass DBPASS  SQL database password
  --cors CORS      Enable CORS
  -r               Automatic reloading
  -d               Enable dashboardImportapp.pyfrombottle_suiteimportBottleSuiteapp=BottleSuite()app.run(reloader=True)ResourcesResource FolderBottle Suite will attempt to automatically find Resources objects in a resource folder in the working directory and create endpoints for them. By default it will look for a folder named "resources". All ".py" files in the folder will be scanned for Resource objects.Example Project Structure├── src
│   ├── resources
│   │   ├── __init__.py
│   │   ├── resource_a.py
|   |   ├── resource_b.py
│   ├── app.pyResource ObjectsSeeBottle REST Tutorialresource_a.pyfrombottle_suiteimportResourceclassResourceA(Resource):defoptions(self):passdefget(self):return{}defpost(self):passdefput(self):passdefpatch(self):passdefdelete(self):passAdding Endpoints for ResourcesBottle Suite has a Bottle REST object. Resources can be added by accessing the Bottle REST object and callingaddResource().app.pyfromresources.resource_aimportResourceAfrombottle_suiteimportBottleSuiteapp=BottleSuite()app.rest.addResource(ResourceA,"/resource_a")app.run(reloader=True)
Package: bottle-swagger
AboutThis project is a Bottle plugin for working with Swagger.Bottleis a Python web framework.Swagger (OpenAPI)is a standard for defining REST APIs.So if you are serving a REST API with Bottle,
and you have a defined a Swagger schema for that API,
this plugin can:Validate incoming requests and outgoing responses against the swagger schemaReturn appropriate error responses on validation failuresServe your swagger schema via Bottle (for use inSwagger UIfor example)RequirementsPython >= 2.7Bottle >= 0.12Swagger specification >= 2.0This project relies onbravado-coreto perform the swagger schema validation,
so any version of the Swagger spec supported by that project is also supported by this plugin.Installation$ pip install bottle-swaggerUsageSee the “example” directory for a working example of using this plugin.The simplest usage is:import bottle

swagger_def = _load_swagger_def()
bottle.install(SwaggerPlugin(swagger_def))Where “_load_swagger_def” returns a dict representing your swagger specification
(loaded from a yaml file, for example).There are a number of arguments that you can pass to the plugin constructor:validate_requests- Boolean (defaultTrue) indicating if incoming requests should be validated or notvalidate_responses- Boolean (defaultTrue) indicating if outgoing responses should be validated or notignore_undefined_routes- Boolean (defaultFalse) indicating if undefined routes
(that is, routes not defined in the swagger spec) should be passed on (“True”) or return a 404 (“False”)invalid_request_handler- Callback called when request validation has failed.
Default behaviour is to return a “400 Bad Request” response.invalid_response_handler- Callback called when response validation has failed.
Default behaviour is to return a “500 Server Error” response.swagger_op_not_found_handler- Callback called when no swagger operation matching the request was found in the swagger schema.
Default behaviour is to return a “404 Not Found” response.exception_handler=_server_error_handler- Callback called when an exception is thrown by downstream handlers (including exceptions thrown by your code).
Default behaviour is to return a “500 Server Error” response.serve_swagger_schema- Boolean (defaultTrue) indicating if the Swagger schema JSON should be servedswagger_schema_url- URL (default/swagger.json) on which to serve the Swagger schema JSONAll the callbacks above receive a single parameter representing theExceptionthat was raised,
or in the case ofswagger_op_not_found_handlertheRoutethat was not found.
They should all return a BottleResponseobject.ContributingDevelopment happens in thebottle-swagger GitHub respository.
Pull requests (with accompanying unit tests), feature suggestions and bug reports are welcome.Use “tox” to run the unit tests:$ tox
Package: bottletools
Useful tools to work with s3 stack in PythonDescriptionIt consists of one module:s3tools: tools to work with S3 filesInstallationNormal installationpipinstallbottletoolsDevelopment installationgitclonehttps://github.com/smartad/bottletools.gitcdbottletools
pipinstall--editable.Change log[0.0.3] - 2020-06-29Addeds3tools.get_public_urls3tools.dumpChangedRemoved[0.0.1] - 2020-06-29Addeds3tools.get_s3_datas3tools.get_s3_data_path_stringioChangedRemoved
Package: bottle-tools
Bottle-ToolsA set of tools to make things easier to work with when using Bottle.Full DocumentationAutofill APIs with typed informationimportbottle_toolsasbtbt.common_kwargs.update({"User":UserTable})@app.post('/calculate')@bt.fill_args(coerce_types=True)deflogin(usrname:str,pwd:str,User):user=User.get_or_404(usrname=usrname)ifnotuser.password_is_correct(pwd):raiseHttpNotFound()return'ok'
Package: bottle-tornadosocket
Bottle Tornado Websocket========================This project adds websocket capabilities to [bottle](http://bottlepy.org), leveraging [tornado](http://www.tornadoweb.org/)### InstallUse `pip` or `easy_install`:pip install bottle-tornado-websocket### Requirements* Bottle* Tornado### UsageImport the server and tornado's WebSocketHandler:from bottle.ext.tornadosocket import TornadoWebSocketServerfrom tornado.websocket import WebSocketHandlerCreate your application handlers, for example:class EchoWebSocket(tornado.websocket.WebSocketHandler):def open(self):print 'Connected')def on_message(self, message):self.write(message)def on_close(self):print 'Connection closed')Map handlers to urls:tornado_handlers = [(r"/echo", EchoWebSocket)]Note: the `.*` is automatically mapped as a last handler to your normal bottle applicationAnd then use the provided server:run(port=8080, server=TornadoWebSocketServer, handlers=tornado_handlers)### ExampleTo echo chat example just run `chat.py` in `examples/echo` folder:python echo.pyTo run chat example just run `chat.py` in `examples/chat` folder:python chat.py
Package: bottle-tornado-websocket
Bottle Tornado Websocket========================This project adds websocket capabilities to [bottle](http://bottlepy.org), leveraging [tornado](http://www.tornadoweb.org/)### InstallUse `pip` or `easy_install`:pip install bottle-tornado-websocket### Requirements* Bottle* Tornado### UsageImport the server and tornado's WebSocketHandler:from bottle_tornado_websocket import TornadoWebSocketServerfrom tornado.websocket import WebSocketHandlerCreate your application handlers, for example:class EchoWebSocket(tornado.websocket.WebSocketHandler):def open(self):print 'Connected')def on_message(self, message):self.write(message)def on_close(self):print 'Connection closed')Map handlers to urls:tornado_handlers = [(r"/echo", EchoWebSocket)]Note: the `.*` is automatically mapped as a last handler to your normal bottle applicationAnd then use the provided server:run(port=8080, server=TornadoWebSocketServer, handlers=tornado_handlers)### ExampleTo echo chat example just run `chat.py` in `examples/echo` folder:python echo.pyTo run chat example just run `chat.py` in `examples/chat` folder:python chat.py
Package: bottleutils
# bottle-utilsReusable components for bottle## Responses### Plugin response.JsonResponsePluginThe JSON response plugin is a plugin that provides three main features:Returns dict or list responses as a JSON object: {“result”: <output>}
* If the response is a dict containing either “result” or “error”, the result is returned as-isCatches HTTPResponse exceptions (including the subclass HTTPError) and formats them as a JSON object: {“error”: {“code”: <http response code>, “message”: <exception message>}}Provides an error handler that can be used to replace the standard error handler with one that returns JSON objects
* The handler must be manually applied for each error code to each app, except as shown below## SQLAlchemyThe SQLAlchemy package must be installed, and is NOT a requirement of this package as a whole!  Make sure it is installed or ImportError will be raised.### Plugin sqlalchemy.SQLAlchemyNotFoundPluginThe SQLAlchemy not found plugin converts SQLAlchemy not found exceptions to 404s.  Apply within the JsonResponsePlugin to turn not found objects into a nicely formatted JSON error message.### Plugin sqlalchemy.SQLAlchemySessionGiven an sqlalchemy engine in the constructor, this plugin creates bottle.request.sa_session that can be used for querying.  This results in a new session for each thread/request.  The kwarg “autocommit” may also be passed, turning automatic commits on or off (default: True)## Apps### Function apps.setupSet up a collection of apps.  The function accepts the following arguments:main_app (required): “main” app on which other apps are mountedsub_apps (optional): List containing either plain application instances (which are not mounted anywhere) or lists containing [app, mountpoint], where the app is mounted to main_app at mountpoint.  The main_app is automatically added to this list - do not add it yourself.plugins (optional): list of plugins to install to all appserror_handlers (optional): List containing either error handler callbacks, or lists containing [range, handler] where handler is applied to all error codes in range (default range is 300-599)error_handler_generators (optional): List containing either methods that generate error handler callbacks, or lists containing [range, handler_generator] where handler_generator(code) is applied to all error codes in range (default range is 300-599)error_handler_generators can be used to apply the JSON response error handler:setup(mainapp, [otherapp], error_handler_generators = [JsonResponsePlugin.getErrorHandler])
Package: bottle-utils
============Bottle utils============Assortment of frequently used utilities for Bottle.This package contains utilities for developing web sites and web applicationsusing `Bottle <http://bottlepy.org/>`_ framework. It is divided into severalmodules of which the ``lazy`` module is not Bottle-specific.The bottle-utils are created from a bunch of unrelated modules we frequentlyused at `Outernet <https://outernet.is/>`_. Some of the modules have beentested fairly thoroughly, and some have been used only in a handful ofprojects. Therefore, not all modules are of high quality. You should conisderthis package Alpha quality.Installation============Install using ``pip`` or ``easy_install``::pip install bottle-utilseasy_install bottle-utils.. note::Between versions 0.3 and 0.5, bottle-utils have been split into multiplepackages. Since 0.5, they have been remerged into a single packages as wenormally use them together, and having them as separate packages causesvarious deployment issues.Documentation=============Detailed documentation is available `online<http://bottle-utils.readthedocs.org/>`_.You can also generate offline documentation by cloning this repository anddoing the following::cd /path/to/repocd docsmake htmlThe ``docs/build/html`` directory should contain full HTML documentation. Youcan start from the ``index.html`` file.Bugs====Please report all bugs to our `GitHub issue tracker`_.License=======This package is licensed under BSD license. See LICENSE_ for moreinfo... _Bottle: http://bottlepy.org/.. _Outernet: https://www.outernet.is/.. _GitHub issue tracker: https://github.com/Outernet-Project/bottle-utils/issues.. _LICENSE: LICENSE
Package: bottle-web2pydal
Bottle-DAL is a plugin that integrates Web2py DAL Database Abstraction Layerwith your Bottle application. It automatically connects to a database at thebeginning of a request, passes the database handle to the route callback andcloses the connection afterwards.To automatically detect routes that need a database connection, the pluginsearches for route callbacks that require a `db` keyword argument(configurable) and skips routes that do not. This removes any overhead forroutes that don't need a database connection.Usage Example::from bottle import route, view, run, debug, installfrom bottle_dal import DALPlugin, Fielddef define_tables(db):"""My tables definitions here"""db.define_table('person',Field('name','string'))install(DALPlugin('sqlite://storage.sqlite',define_tables = lambda db: define_tables(db)))@route('/')def index(db):""" Index Example """if db(db.person.id>0).count()==0:db.person.insert(name='James')db.person.insert(name='Michael')db.person.insert(name='Steve')db.person.insert(name='Robert')db.commit()persons = db(db.person.id>0).select()return dict(persons=persons.json())if __name__ == '__main__':debug(True)run(host='localhost', port=8080)
Package: bottle-websocket
This project adds websocket capabilities to [bottle](http://bottlepy.org), leveraging [gevent-websocket](http://www.gelens.org/code/gevent-websocket/) and [gevent](http://www.gevent.org/).### InstallUse `pip` or `easy_install`:pip install bottle-websocket### UsageUsage is pretty straight-forward, just import the server and plugin:from bottle.ext.websocket import GeventWebSocketServerfrom bottle.ext.websocket import websocketYou can use the websocket plugin to turn routes websocket handlers, the websocket is passed to the route as the first argument:@get('/websocket', apply=[websocket])def echo(ws):while True:msg = ws.receive()if msg is not None:ws.send(msg)else: breakAnd then use the provided server:run(host='127.0.0.1', port=8080, server=GeventWebSocketServer)### Contributors- [zeekay](https://github.com/zeekay)- [xeross](https://github.com/xeross)
Package: bottle-yang-extractor-validator
# Bottle-based YANG Extractor and ValidatorA web application that allows you to fetch, extract and validate YANG modules by RFC number, by IETF draft name, or by uploading YANG files. It is built on top of the [bottle](http://bottlepy.org/docs/dev/index.html) python micro-web framework using a combination of [xym](https://github.com/YangModels/yang/tree/master/tools/xym) to fetch and extract YANG modules from IETF specifications, and [pyang](https://github.com/mbj4668/pyang), [confdc](https://developer.cisco.com/site/confD/downloads/) and [yanglint](https://github.com/CESNET/libyang) YANG compilers to validate the extracted modules.## Prerequisites
The following requirements will be installed by the pip installation script:
- The [bottle](https://bottlepy.org/) micro-framework
- The bottle application defaults to requiring the [cherrypy](http://www.cherrypy.org/) web framework
- The [pyang](https://github.com/mbj4668/pyang) tool
- The [xym](https://github.com/xym-tool/xym) toolThe following tools will need to be manually preinstalled:
- The [yanglint](https://github.com/CESNET/libyang) tool needs to be preinstalled
- The [confdc](https://developer.cisco.com/site/confD/downloads/) compiler needs to be preinstalled, use the–confd-install-pathoption to point to the ConfD install directory (i.e.$CONFD_DIR)
- YANG modules commonly required for validation (e.g. the IETF modules for interface and ip configuration as well as the types) are expected to be in/var/tmp/yangmodules/extracted- The default port is 8080 to avoid requiring root privileges. Use the–port=80option with root privileges to listen to the default HTTP port.## Preparing the YANG modules
Thesync.shscript uses rsync to download all IETF RFCs and drafts to a temporary directory, and then extracts all found YANG modules usingxym. Pleaseread and understandthe script before you run it.