Adding urljoin method to Adaptors and Responses
This commit is contained in:
@@ -2,6 +2,7 @@ import inspect
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from difflib import SequenceMatcher
|
from difflib import SequenceMatcher
|
||||||
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from cssselect import SelectorError, SelectorSyntaxError
|
from cssselect import SelectorError, SelectorSyntaxError
|
||||||
from cssselect import parse as split_selectors
|
from cssselect import parse as split_selectors
|
||||||
@@ -243,6 +244,10 @@ class Adaptor(SelectorsGeneration):
|
|||||||
|
|
||||||
return TextHandler(separator.join([s for s in _all_strings]))
|
return TextHandler(separator.join([s for s in _all_strings]))
|
||||||
|
|
||||||
|
def urljoin(self, relative_url: str) -> str:
|
||||||
|
"""Join this Adaptor's url with a relative url to form an absolute full URL."""
|
||||||
|
return urljoin(self.url, relative_url)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def attrib(self) -> AttributesHandler:
|
def attrib(self) -> AttributesHandler:
|
||||||
"""Get attributes of the element"""
|
"""Get attributes of the element"""
|
||||||
|
|||||||
Reference in New Issue
Block a user