Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Bottle.py suite with CORS, SQL, REST, and JWT
python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ bottle-suite --upgrade
$ bottle-suite-create
Enter project name. <bottle-suite-project>:
Create a SQLite database? [y/N]:
Attach an SQL database? [y/N]:
Created project bottle-suite-project
cd bottle-suite-project
bottle-suite -d -r
$ cd bottle-suite-project
$ bottle-suite -d -r
View dashboard @ http://localhost:8000/dashboard
Bottle v0.13-dev server starting up (using WSGIRefServer(dashboard=True))...
Listening on http://localhost:8000/
Hit Ctrl-C to quit.
usage: 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 dashboard
app.py
from bottle_suite import BottleSuite
app = BottleSuite()
app.run(reloader=True)
Bottle 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.
├── src
│ ├── resources
│ │ ├── __init__.py
│ │ ├── resource_a.py
| | ├── resource_b.py
│ ├── app.py
from bottle_suite import Resource
class ResourceA(Resource):
def options(self):
pass
def get(self):
return {}
def post(self):
pass
def put(self):
pass
def patch(self):
pass
def delete(self):
pass
Bottle Suite has a Bottle REST object. Resources can be added by accessing the Bottle REST object and calling addResource().
from resources.resource_a import ResourceA
from bottle_suite import BottleSuite
app = BottleSuite()
app.rest.addResource(ResourceA, "/resource_a")
app.run(reloader=True)
FAQs
bottle.py suite with CORS, SQL, REST, and JWT
We found that bottle-suite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.