def _get_url(self):
"""
Returns: string_type or parse.ParseResult or parse SplitResult
We have a vague return type for _get_url method
because we could not generalise regex support for all
backends. So we are directly passing result to backends.
That way users can use regex that their backend provides.
"""
if self.url is NotImplemented:
raise NotImplementedError('To use placebo, you need to either '
'provide url attribute or '
'overwrite get_url method in subclass.')
else:
url = invoke_or_get(self.url)
# if url is a string convert it to ParsedUrl
# if isinstance(url, six.string_types):
# url = parse.urlparse(url)
# TODO: check return type
return url
评论列表
文章目录