Skip to content

Commit c41c399

Browse files
committed
initial import of selenium extensions for bonobo
1 parent febfd3d commit c41c399

File tree

15 files changed

+206
-0
lines changed

15 files changed

+206
-0
lines changed

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
*$py.class
2+
*,cover
3+
*.egg
4+
*.egg-info/
5+
*.log
6+
*.manifest
7+
*.mo
8+
*.pot
9+
*.py[cod]
10+
*.so
11+
*.spec
12+
.Python
13+
.cache
14+
.coverage
15+
.coverage.*
16+
.eggs/
17+
.env
18+
.hypothesis/
19+
.installed.cfg
20+
.ipynb_checkpoints
21+
.python-version
22+
.tox/
23+
.webassets-cache
24+
/.idea
25+
/bonobo.iml
26+
/bonobo/ext/jupyter/js/node_modules/
27+
/build/
28+
/coverage.xml
29+
/develop-eggs/
30+
/dist/
31+
/docs/_build/
32+
/downloads/
33+
/eggs/
34+
/examples/private
35+
/htmlcov/
36+
/sdist/
37+
celerybeat-schedule
38+
parts/
39+
pip-delete-this-directory.txt
40+
pip-log.txt

.landscape.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
doc-warnings: true
2+
test-warnings: true
3+
strictness: veryhigh
4+
max-line-length: 120
5+
autodetect: true
6+
python-targets:
7+
- 3
8+
ignore-paths:
9+
- docs
10+
- examples
11+
- tests
12+
pep257:
13+
disable:
14+
- D205
15+
- D210

.style.yapf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[style]
2+
based_on_style = pep8
3+
column_limit = 120

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: python
2+
python:
3+
- 3.5
4+
- 3.5-dev
5+
- 3.6
6+
- 3.6-dev
7+
- nightly
8+
install:
9+
- make install-dev
10+
- pip install coveralls
11+
script:
12+
- make clean docs test
13+
after_success:
14+
- coveralls

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include *.txt

Makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This file has been auto-generated.
2+
# All changes will be lost, see Projectfile.
3+
#
4+
# Updated at 2016-12-28 13:00:03.652442
5+
6+
PYTHON ?= $(shell which python)
7+
PYTHON_BASENAME ?= $(shell basename $(PYTHON))
8+
PYTHON_REQUIREMENTS_FILE ?= requirements.txt
9+
PYTHON_REQUIREMENTS_DEV_FILE ?= requirements-dev.txt
10+
QUICK ?=
11+
VIRTUAL_ENV ?= .virtualenv-$(PYTHON_BASENAME)
12+
PIP ?= $(VIRTUAL_ENV)/bin/pip
13+
PYTEST ?= $(VIRTUAL_ENV)/bin/pytest
14+
PYTEST_OPTIONS ?= --capture=no --cov=bonobo_selenium --cov-report html
15+
SPHINX_OPTS ?=
16+
SPHINX_BUILD ?= $(VIRTUAL_ENV)/bin/sphinx-build
17+
SPHINX_SOURCEDIR ?= docs
18+
SPHINX_BUILDDIR ?= $(SPHINX_SOURCEDIR)/_build
19+
20+
.PHONY: $(SPHINX_SOURCEDIR) clean install install-dev lint test
21+
22+
# Installs the local project dependencies.
23+
install: $(VIRTUAL_ENV)
24+
if [ -z "$(QUICK)" ]; then \
25+
$(PIP) install -Ur $(PYTHON_REQUIREMENTS_FILE) ; \
26+
fi
27+
28+
# Installs the local project dependencies, including development-only libraries.
29+
install-dev: $(VIRTUAL_ENV)
30+
if [ -z "$(QUICK)" ]; then \
31+
$(PIP) install -Ur $(PYTHON_REQUIREMENTS_DEV_FILE) ; \
32+
fi
33+
34+
# Cleans up the local mess.
35+
clean:
36+
rm -rf build
37+
rm -rf dist
38+
39+
# Setup the local virtualenv, or use the one provided by the current environment.
40+
$(VIRTUAL_ENV):
41+
virtualenv -p $(PYTHON) $(VIRTUAL_ENV)
42+
$(PIP) install -U pip\>=8.1.2,\<9 wheel\>=0.29,\<1.0
43+
ln -fs $(VIRTUAL_ENV)/bin/activate activate-$(PYTHON_BASENAME)
44+
45+
lint: install-dev
46+
$(VIRTUAL_ENV)/bin/pylint --py3k bonobo_selenium -f html > pylint.html
47+
48+
test: install-dev
49+
$(PYTEST) $(PYTEST_OPTIONS) tests
50+
51+
$(SPHINX_SOURCEDIR): install-dev
52+
$(SPHINX_BUILD) -b html -D latex_paper_size=a4 $(SPHINX_OPTS) $(SPHINX_SOURCEDIR) $(SPHINX_BUILDDIR)/html

README.rst

Whitespace-only changes.

bonobo_selenium/__init__.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import selenium.webdriver
2+
3+
from bonobo import service
4+
5+
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/601.4.4 (KHTML, like Gecko) Version/9.0.3 Safari/601.4.4'
6+
7+
8+
def create_profile(use_tor=False):
9+
_profile = selenium.webdriver.FirefoxProfile()
10+
_profile.set_preference("toolkit.startup.max_resumed_crashes", "-1")
11+
12+
if use_tor:
13+
# tor connection
14+
_profile.set_preference('network.proxy.type', 1)
15+
_profile.set_preference('network.proxy.socks', '127.0.0.1')
16+
_profile.set_preference('network.proxy.socks_port', 9050)
17+
18+
# user agent
19+
_profile.set_preference("general.useragent.override", USER_AGENT)
20+
21+
return _profile
22+
23+
24+
def create_browser(profile):
25+
_browser = selenium.webdriver.Firefox(profile)
26+
_browser.implicitly_wait(10)
27+
_browser.set_page_load_timeout(10)
28+
return _browser
29+
30+
31+
@service
32+
def browser():
33+
return create_browser(create_profile(use_tor=False))
34+
35+
36+
@service
37+
def torbrowser():
38+
return create_browser(create_profile(use_tor=True))

classifiers.txt

Whitespace-only changes.

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-e .[dev]

0 commit comments

Comments
 (0)