Given a page url and a dict of params, open and return the page.

        :param url: the url to grab content from.
        :param params: a dictionary containing the GET data to put in the url
        :param data: a dictionary containing the extra data to submit
        :param files: a dictionary specifying the files to upload
        :param auth: Add the HTTP authentication headers (see requests)
        :param timeout: Specifies the maximum time that the actual HTTP request
            can take.
        :param raw_response: return the response object rather than the
            response body
        :param retry_on_error: if True retry the request, if it fails, for up
            to 3 attempts
        :returns: either the response body or the response object

def _request(self, url, params=None, data=None, files=None, auth=None,
                 timeout=None, raw_response=False, retry_on_error=True,
                 method=None):
        """Given a page url and a dict of params, open and return the page.

        :param url: the url to grab content from.
        :param params: a dictionary containing the GET data to put in the url
        :param data: a dictionary containing the extra data to submit
        :param files: a dictionary specifying the files to upload
        :param auth: Add the HTTP authentication headers (see requests)
        :param timeout: Specifies the maximum time that the actual HTTP request
            can take.
        :param raw_response: return the response object rather than the
            response body
        :param retry_on_error: if True retry the request, if it fails, for up
            to 3 attempts
        :returns: either the response body or the response object

        """
        def build_key_items(url, params, data, auth, files, method):
            request = _prepare_request(self, url, params, data, auth, files,
                                       method)

            # Prepare extra arguments
            key_items = []
            oauth = request.headers.get('Authorization', None)
            for key_value in (params, data, request.cookies, auth, oauth):
                if isinstance(key_value, dict):
                    key_items.append(tuple(key_value.items()))
                elif isinstance(key_value, http_cookiejar.CookieJar):
                    key_items.append(tuple(key_value.get_dict().items()))
                else:
                    key_items.append(key_value)
            kwargs = {'_rate_domain': self.config.domain,
                      '_rate_delay': int(self.config.api_request_delay),
                      '_cache_ignore': bool(files) or raw_response,
                      '_cache_timeout': int(self.config.cache_timeout)}

            return (request, key_items, kwargs)

        def decode(match):
            return six.unichr(html_entities.name2codepoint[match.group(1)])

        def handle_redirect():
            response = None
            url = request.url
            while url:  # Manually handle 302 redirects
                request.url = url
                kwargs['_cache_key'] = (normalize_url(request.url),
                                        tuple(key_items))
                response = self.handler.request(
                    request=request.prepare(),
                    proxies=self.http.proxies,
                    timeout=timeout,
                    verify=self.http.validate_certs, **kwargs)

                if self.config.log_requests >= 2:
                    msg = 'status: {0}\n'.format(response.status_code)
                    sys.stderr.write(msg)
                url = _raise_redirect_exceptions(response)
                assert url != request.url
            return response

        timeout = self.config.timeout if timeout is None else timeout
        request, key_items, kwargs = build_key_items(url, params, data,
                                                     auth, files, method)

        tempauth = self._use_oauth
        remaining_attempts = 3 if retry_on_error else 1
        attempt_oauth_refresh = bool(self.refresh_token)
        while True:
            try:
                self._use_oauth = self.is_oauth_session()
                response = handle_redirect()
                _raise_response_exceptions(response)
                self.http.cookies.update(response.cookies)
                if raw_response:
                    return response
                else:
                    return re.sub('&([^;]+);', decode, response.text)
            except errors.OAuthInvalidToken as error:
                if not attempt_oauth_refresh:
                    raise
                attempt_oauth_refresh = False
                self._use_oauth = False
                self.refresh_access_information()
                self._use_oauth = tempauth
                request, key_items, kwargs = build_key_items(url, params,
                                                             data, auth, files,
                                                             method)
            except errors.HTTPException as error:
                remaining_attempts -= 1
                # pylint: disable=W0212
                if error._raw.status_code not in self.RETRY_CODES or \
                        remaining_attempts == 0:
                    raise
            finally:
                self._use_oauth = tempauth