def _get_token(self, request, refresh_token=False):
if self.config.cookie_set():<EOL><INDENT>token = self._get_token_from_cookies(request, refresh_token)<EOL>if token:<EOL><INDENT>return token<EOL><DEDENT>else:<EOL><INDENT>if self.config.cookie_strict():<EOL><INDENT>raise exceptions.MissingAuthorizationCookie()<EOL><DEDENT><DEDENT><DEDENT>if self.config.query_string_set():<EOL><INDENT>token = self._get_token_from_query_string(request, refresh_token)<EOL>if token:<EOL><INDENT>return token<EOL><DEDENT>else:<EOL><INDENT>if self.config.query_string_strict():<EOL><INDENT>raise exceptions.MissingAuthorizationQueryArg()<EOL><DEDENT><DEDENT><DEDENT>token = self._get_token_from_headers(request, refresh_token)<EOL>if token:<EOL><INDENT>return token<EOL><DEDENT>raise exceptions.MissingAuthorizationHeader()<EOL>
Extract a token from a request object.