def open(self, url_string, follow_redirects=True, **kwargs):
"""GETs the URL in `url_string`.
:param url_string: A string containing the URL to be opened.
:keyword follow_redirects: If False, this method acts as a simple GET request. If True (the default),
the method hebaves like a browser would, by opening redirect responses.
:keyword relative: Set to True to indicate that `url_string` contains a path relative to the current location.
Other keyword arguments are passed directly on to
`WebTest.get <http://webtest.readthedocs.org/en/latest/api.html#webtest.app.TestApp.get>`_.
"""
if self.last_response:
self.history.append(self.last_response.request.url)
relative = not url_string.startswith('/')
if relative:
url_string = self.get_full_path(url_string)
self.last_response = self.testapp.get(url_string, **kwargs)
if follow_redirects:
self.follow_response()
评论列表
文章目录