Skip to content

Commit 7ae7e12

Browse files
committed
rename to robobrowser
1 parent 7dc9fc9 commit 7ae7e12

26 files changed

+140
-230
lines changed

.coveragerc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[report]
22
omit =
3-
pyrobot/ordereddict.py
4-
pyrobot/responses.py
3+
robobrowser/ordereddict.py
4+
robobrowser/responses.py
55
*/python?.?/*
66
*/lib-python/?.?/*.py
77
*/pypy/*

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ install:
1414
- pip install coverage coveralls nose responses
1515

1616
# command to run tests, e.g. python setup.py test
17-
script: nosetests --with-coverage --cover-package=pyrobot
17+
script: nosetests --with-coverage --cover-package=robobrowser
1818

1919
after_success: coveralls

AUTHORS.rst

-13
This file was deleted.

CONTRIBUTING.rst

-111
This file was deleted.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Redistribution and use in source and binary forms, with or without modification,
77

88
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
99

10-
* Neither the name of pyrobot nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10+
* Neither the name of robobrowser nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
1111

1212
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ clean-pyc:
2424
find . -name '*~' -exec rm -f {} +
2525

2626
lint:
27-
flake8 pyrobot tests
27+
flake8 robobrowser tests
2828

2929
test:
3030
python setup.py test
@@ -33,15 +33,15 @@ test-all:
3333
tox
3434

3535
coverage:
36-
coverage run --source pyrobot setup.py test
36+
coverage run --source robobrowser setup.py test
3737
coverage report -m
3838
coverage html
3939
open htmlcov/index.html
4040

4141
docs:
42-
rm -f docs/pyrobot.rst
42+
rm -f docs/robobrowser.rst
4343
rm -f docs/modules.rst
44-
sphinx-apidoc -o docs/ pyrobot
44+
sphinx-apidoc -o docs/ robobrowser
4545
$(MAKE) -C docs clean
4646
$(MAKE) -C docs html
4747
open docs/_build/html/index.html

README.rst

+40-21
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,62 @@
1-
PyRobot: Your friendly neighborhood web scraper
1+
RoboBrowser: Your friendly neighborhood web scraper
22
===============================================
33

4-
.. image:: https://badge.fury.io/py/pyrobot.png
5-
:target: http://badge.fury.io/py/pyrobot
4+
.. image:: https://badge.fury.io/py/robobrowser.png
5+
:target: http://badge.fury.io/py/robobrowser
66

7-
.. image:: https://travis-ci.org/jmcarp/pyrobot.png?branch=master
8-
:target: https://travis-ci.org/jmcarp/pyrobot
7+
.. image:: https://travis-ci.org/jmcarp/robobrowser.png?branch=master
8+
:target: https://travis-ci.org/jmcarp/robobrowser
99

10-
.. image:: https://coveralls.io/repos/jmcarp/pyrobot/badge.png?branch=master
11-
:target: https://coveralls.io/r/jmcarp/pyrobot
10+
.. image:: https://coveralls.io/repos/jmcarp/robobrowser/badge.png?branch=master
11+
:target: https://coveralls.io/r/jmcarp/robobrowser
1212

13-
Homepage: `http://pyrobot.readthedocs.org/ <http://pyrobot.readthedocs.org/>`_
13+
Homepage: `http://robobrowser.readthedocs.org/ <http://robobrowser.readthedocs.org/>`_
14+
15+
RoboBrowser is a simple, Pythonic library for browsing the web without a standalone web browser. RoboBrowser
16+
can fetch a page, click on links and buttons, and fill out and submit forms. If you need to interact with services
17+
that don't have APIs, RoboBrowser can help.
1418

1519
.. code-block:: python
1620
1721
import re
18-
from pyrobot import RoboBrowser
22+
from robobrowser import RoboBrowser
1923
2024
# Browse to Rap Genius
2125
browser = RoboBrowser(history=True)
2226
browser.open('http://rapgenius.com/')
2327
2428
# Search for Queen
25-
form = browser.get_form(action=re.compile(r'search'))
29+
form = browser.get_form(action='/search')
30+
form # <RoboForm q=>
2631
form['q'].value = 'queen'
2732
browser.submit_form(form)
2833
2934
# Look up the first song
3035
songs = browser.select('.song_name')
3136
browser.follow_link(songs[0])
32-
lyrics = browser.find(class_=re.compile(r'\blyrics\b'))
33-
lyrics.text # \n[Intro]\nIs this the real life...
37+
lyrics = browser.select('.lyrics')
38+
lyrics[0].text # \n[Intro]\nIs this the real life...
3439
3540
# Back to results page
3641
browser.back()
3742
3843
# Look up my favorite song
3944
browser.follow_link('death on two legs')
45+
46+
# Can also search HTML using regex patterns
4047
lyrics = browser.find(class_=re.compile(r'\blyrics\b'))
4148
lyrics.text # \n[Verse 1]\nYou suck my blood like a leech...
4249
43-
PyRobot combines the best of two excellent Python libraries:
50+
RoboBrowser combines the best of two excellent Python libraries:
4451
`Requests <http://docs.python-requests.org/en/latest/>`_ and
4552
`BeautifulSoup <http://www.crummy.com/software/BeautifulSoup/>`_.
46-
PyRobot represents browser sessions using Requests and HTML responses
53+
RoboBrowser represents browser sessions using Requests and HTML responses
4754
using BeautifulSoup, transparently exposing methods of both libraries:
4855

4956
.. code-block:: python
5057
5158
import re
52-
from pyrobot import RoboBrowser
59+
from robobrowser import RoboBrowser
5360
5461
browser = RoboBrowser(user_agent='a python robot')
5562
browser.open('https://github.com/')
@@ -58,7 +65,7 @@ using BeautifulSoup, transparently exposing methods of both libraries:
5865
browser.session.cookies['_gh_sess'] # BAh7Bzo...
5966
browser.session.headers['User-Agent'] # a python robot
6067
61-
# Searched the parsed HTML
68+
# Search the parsed HTML
6269
browser.select('div.teaser-icon') # [<div class="teaser-icon">
6370
# <span class="mega-octicon octicon-checklist"></span>
6471
# </div>,
@@ -68,24 +75,26 @@ using BeautifulSoup, transparently exposing methods of both libraries:
6875
# <span class="mega-octicon octicon-checklist"></span>
6976
# ...
7077
71-
PyRobot also includes tools for working with forms, inspired by
78+
RoboBrowser also includes tools for working with forms, inspired by
7279
`WebTest <https://github.com/Pylons/webtest>`_ and `Mechanize <http://wwwsearch.sourceforge.net/mechanize/>`_.
7380

7481
.. code-block:: python
7582
76-
from pyrobot import Browser
83+
from robobrowser import RoboBrowser
84+
7785
browser = RoboBrowser()
86+
browser.open('http://twitter.com')
7887
7988
# Get the signup form
8089
signup_form = browser.get_form(class_='signup')
81-
signup_form # <RoboForm user[name]=, user[email]=, ...
90+
signup_form # <RoboForm user[name]=, user[email]=, ...
8291
8392
# Inspect its values
8493
signup_form['authenticity_token'].value # 6d03597 ...
8594
8695
# Fill it out
87-
signup_form['user[name]'] = 'python-robot'
88-
signup_form['user[user_password]'] = 'secret'
96+
signup_form['user[name]'].value = 'python-robot'
97+
signup_form['user[user_password]'].value = 'secret'
8998
9099
# Serialize it to JSON
91100
signup_form.serialize() # {'data': {'authenticity_token': '6d03597...',
@@ -97,3 +106,13 @@ PyRobot also includes tools for working with forms, inspired by
97106
# And submit
98107
browser.submit_form(signup_form)
99108
109+
Requirements
110+
------------
111+
112+
- Python >= 2.6 or >= 3.3
113+
114+
License
115+
-------
116+
117+
MIT licensed. See the bundled `LICENSE <https://github.com/jmcarp/robobrowser/blob/master/LICENSE>`_ file for more details.
118+

dev-requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
-r requirements.txt
2+
13
coverage
24
coveralls
35
nose

docs/api.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ API Reference
66
browser
77
------------
88

9-
.. automodule:: pyrobot.browser
9+
.. automodule:: robobrowser.browser
1010
:members:
1111

1212
form
1313
------------
1414

15-
.. automodule:: pyrobot.forms.form
15+
.. automodule:: robobrowser.forms.form
1616
:members:
1717

1818
fields
1919
------------
2020

21-
.. automodule:: pyrobot.forms.fields
21+
.. automodule:: robobrowser.forms.fields
2222
:members:
2323
:inherited-members:

0 commit comments

Comments
 (0)