Rename BaseBrowser to Browser

This commit is contained in:
Florent 2014-09-23 10:53:38 +02:00
commit 0088013ae1
132 changed files with 348 additions and 348 deletions

View file

@ -21,11 +21,11 @@
from weboob.tools.browser.browser import BrowserIncorrectPassword, BrowserBanned, \
BrowserUnavailable, BrowserRetry, \
BrowserHTTPNotFound, BrowserHTTPError, \
Page, BaseBrowser, BrokenPageError, \
Page, Browser, BrokenPageError, \
StandardBrowser, BrowserPasswordExpired, \
BrowserForbidden
__all__ = ['BrowserIncorrectPassword', 'BrowserPasswordExpired', 'BrowserBanned',
'BrowserUnavailable', 'BrowserRetry', 'BrowserHTTPNotFound', 'BrowserHTTPError',
'Page', 'BaseBrowser', 'BrokenPageError', 'StandardBrowser', 'BrowserForbidden']
'Page', 'Browser', 'BrokenPageError', 'StandardBrowser', 'BrowserForbidden']

View file

@ -58,7 +58,7 @@ from weboob.tools.parsers import get_parser
__all__ = ['BrowserIncorrectPassword', 'BrowserForbidden', 'BrowserBanned', 'BrowserUnavailable', 'BrowserRetry',
'BrowserPasswordExpired', 'BrowserHTTPNotFound', 'BrowserHTTPError', 'BrokenPageError', 'Page',
'StandardBrowser', 'BaseBrowser']
'StandardBrowser', 'Browser']
class BrowserRetry(Exception):
@ -422,7 +422,7 @@ class StandardBrowser(mechanize.Browser):
class BaseBrowser(StandardBrowser):
class Browser(StandardBrowser):
"""
Base browser class to navigate on a website.

View file

@ -17,9 +17,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .browser import BaseBrowser, DomainBrowser, Wget, Firefox, UrlNotAllowed, Profile
from .browser import Browser, DomainBrowser, Wget, Firefox, UrlNotAllowed, Profile
from .page import PagesBrowser, Page, URL, HTMLPage, LoginBrowser, need_login, JsonPage, LoggedPage, XMLPage
__all__ = ['BaseBrowser', 'DomainBrowser', 'Wget', 'Firefox', 'UrlNotAllowed', 'Profile', 'XMLPage',
__all__ = ['Browser', 'DomainBrowser', 'Wget', 'Firefox', 'UrlNotAllowed', 'Profile', 'XMLPage',
'PagesBrowser', 'Page', 'URL', 'HTMLPage', 'LoginBrowser', 'need_login', 'JsonPage', 'LoggedPage']

View file

@ -116,7 +116,7 @@ class Wget(Profile):
'User-Agent': 'Wget/%s' % self.version})
class BaseBrowser(object):
class Browser(object):
"""
Simple browser class.
Act like a browser, and don't try to do too much.
@ -295,7 +295,7 @@ class BaseBrowser(object):
For example:
>>> BaseBrowser().open('http://google.com', async=True).result().text # doctest: +SKIP
>>> Browser().open('http://google.com', async=True).result().text # doctest: +SKIP
:param url: URL
:type url: str
@ -496,7 +496,7 @@ class UrlNotAllowed(Exception):
"""
class DomainBrowser(BaseBrowser):
class DomainBrowser(Browser):
"""
A browser that handles relative URLs and can have a base URL (usually a domain).
@ -559,7 +559,7 @@ class DomainBrowser(BaseBrowser):
def open(self, req, *args, **kwargs):
"""
Like :meth:`BaseBrowser.open` but hanldes urls without domains, using
Like :meth:`Browser.open` but hanldes urls without domains, using
the :attr:`BASEURL` attribute.
"""
uri = req.url if isinstance(req, requests.Request) else req

View file

@ -287,7 +287,7 @@ class PagesBrowser(DomainBrowser):
callback = kwargs.pop('callback', lambda response: response)
# Have to define a callback to seamlessly process synchronous and
# asynchronous requests, see :meth:`BaseBrowser.open` and its `async`
# asynchronous requests, see :meth:`Browser.open` and its `async`
# and `callback` params.
def internal_callback(response):
# Try to handle the response page with an URL instance.
@ -309,7 +309,7 @@ class PagesBrowser(DomainBrowser):
def location(self, *args, **kwargs):
"""
Same method than
:meth:`weboob.tools.browser2.browser.BaseBrowser.location`, but if the
:meth:`weboob.tools.browser2.browser.Browser.location`, but if the
url matches any :class:`URL` object, an attribute `page` is added to
response, and the attribute :attr:`PagesBrowser.page` is set.
"""

View file

@ -23,7 +23,7 @@ import re
from weboob.capabilities.gallery import CapGallery, BaseGallery, BaseImage
from weboob.tools.backend import Module
from weboob.tools.browser import BaseBrowser, Page
from weboob.tools.browser import Browser, Page
__all__ = ['GenericComicReaderModule']
@ -40,10 +40,10 @@ class DisplayPage(Page):
return self.document.xpath(self.browser.params['page_list_xpath'])
class GenericComicReaderBrowser(BaseBrowser):
class GenericComicReaderBrowser(Browser):
def __init__(self, browser_params, *args, **kwargs):
self.params = browser_params
BaseBrowser.__init__(self, *args, **kwargs)
Browser.__init__(self, *args, **kwargs)
def iter_gallery_images(self, gallery):
self.location(gallery.url)