mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-06-19 12:24:20 -04:00
make brozzler-webconsole a part of the main brozzler package, using optional "extras_require" dependencies
This commit is contained in:
parent
08a9636e95
commit
e4f8efe376
13 changed files with 78 additions and 13 deletions
20
README.rst
20
README.rst
|
@ -70,6 +70,26 @@ must be specified, everything else is optional.
|
||||||
scope:
|
scope:
|
||||||
surt: http://(org,example,
|
surt: http://(org,example,
|
||||||
|
|
||||||
|
Brozzler Web Console
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Brozzler comes with a rudimentary web application for viewing crawl job status.
|
||||||
|
To install the brozzler with dependencies required to run this app, run
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
pip install brozzler[webconsole]
|
||||||
|
|
||||||
|
|
||||||
|
To start the app, run
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
brozzler-webconsole
|
||||||
|
|
||||||
|
|
||||||
|
XXX configuration stuff
|
||||||
|
|
||||||
Fonts (for decent screenshots)
|
Fonts (for decent screenshots)
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,22 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import flask
|
import logging
|
||||||
|
import sys
|
||||||
|
try:
|
||||||
|
import flask
|
||||||
|
except ImportError as e:
|
||||||
|
logging.critical(
|
||||||
|
'%s: %s\n\nYou might need to run "pip install '
|
||||||
|
'brozzler[webconsole]".\nSee README.rst for more information.',
|
||||||
|
type(e).__name__, e)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
import rethinkstuff
|
import rethinkstuff
|
||||||
import json
|
import json
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import importlib
|
import importlib
|
||||||
import rethinkdb
|
import rethinkdb
|
||||||
import logging
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
# flask does its own logging config
|
# flask does its own logging config
|
||||||
|
@ -157,6 +165,39 @@ def api404(path):
|
||||||
def root(path):
|
def root(path):
|
||||||
return flask.render_template("index.html")
|
return flask.render_template("index.html")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
import pdb; pdb.set_trace()
|
||||||
app.run(host="0.0.0.0", port=8081, debug=True)
|
try:
|
||||||
|
import gunicorn.app.base
|
||||||
|
from gunicorn.six import iteritems
|
||||||
|
|
||||||
|
class GunicornBrozzlerWebConsole(gunicorn.app.base.BaseApplication):
|
||||||
|
def __init__(self, app, options=None):
|
||||||
|
self.options = options or {}
|
||||||
|
self.application = app
|
||||||
|
super(GunicornBrozzlerWebConsole, self).__init__()
|
||||||
|
|
||||||
|
def load_config(self):
|
||||||
|
config = dict(
|
||||||
|
[(key, value) for key, value in iteritems(self.options)
|
||||||
|
if key in self.cfg.settings and value is not None])
|
||||||
|
for key, value in iteritems(config):
|
||||||
|
self.cfg.set(key.lower(), value)
|
||||||
|
|
||||||
|
def load(self):
|
||||||
|
return self.application
|
||||||
|
|
||||||
|
def run(**options):
|
||||||
|
import pdb; pdb.set_trace()
|
||||||
|
logging.info('running brozzler-webconsole using gunicorn')
|
||||||
|
GunicornBrozzlerWebConsole(app, options).run()
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
def run():
|
||||||
|
import pdb; pdb.set_trace()
|
||||||
|
logging.info('running brozzler-webconsole using simple flask app.run')
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# arguments?
|
||||||
|
run()
|
||||||
|
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
15
setup.py
15
setup.py
|
@ -21,7 +21,7 @@ import glob
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='brozzler',
|
name='brozzler',
|
||||||
version='1.1.dev20',
|
version='1.1.dev21',
|
||||||
description='Distributed web crawling with browsers',
|
description='Distributed web crawling with browsers',
|
||||||
url='https://github.com/internetarchive/brozzler',
|
url='https://github.com/internetarchive/brozzler',
|
||||||
author='Noah Levitt',
|
author='Noah Levitt',
|
||||||
|
@ -31,6 +31,11 @@ setuptools.setup(
|
||||||
packages=['brozzler'],
|
packages=['brozzler'],
|
||||||
package_data={'brozzler': ['behaviors.d/*.js*', 'behaviors.yaml']},
|
package_data={'brozzler': ['behaviors.d/*.js*', 'behaviors.yaml']},
|
||||||
scripts=glob.glob('bin/*'),
|
scripts=glob.glob('bin/*'),
|
||||||
|
entry_points={
|
||||||
|
'console_scripts': [
|
||||||
|
'brozzler-webconsole = brozzler.webconsole:run',
|
||||||
|
],
|
||||||
|
},
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'PyYAML',
|
'PyYAML',
|
||||||
'youtube-dl',
|
'youtube-dl',
|
||||||
|
@ -38,11 +43,15 @@ setuptools.setup(
|
||||||
'requests',
|
'requests',
|
||||||
'websocket-client',
|
'websocket-client',
|
||||||
'pillow',
|
'pillow',
|
||||||
'surt>=0.3b2',
|
'surt>=0.3.0',
|
||||||
'rethinkstuff',
|
'rethinkstuff>=0.1.5',
|
||||||
'rethinkdb>=2.3,<2.4',
|
'rethinkdb>=2.3,<2.4',
|
||||||
'psutil',
|
'psutil',
|
||||||
],
|
],
|
||||||
|
extras_require={
|
||||||
|
'webconsole': ['flask>=0.11', 'gunicorn'],
|
||||||
|
# 'brozzler-easy': ['warcprox', 'pywb'],
|
||||||
|
},
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 4 - Beta',
|
'Development Status :: 4 - Beta',
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
gunicorn --bind=0.0.0.0:8081 brozzler-webconsole:app
|
|
|
@ -1,4 +0,0 @@
|
||||||
rethinkstuff>=0.1.5
|
|
||||||
flask>=0.11
|
|
||||||
gunicorn
|
|
||||||
PyYAML
|
|
Loading…
Add table
Add a link
Reference in a new issue