From 57305c50931fee63833b4d6813f2af521362033f Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 28 May 2019 11:04:13 +0200 Subject: adding missing method. --- src/ee/digikey/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/ee/digikey/__init__.py b/src/ee/digikey/__init__.py index 031faff..4c4adce 100644 --- a/src/ee/digikey/__init__.py +++ b/src/ee/digikey/__init__.py @@ -496,6 +496,13 @@ class DigikeyParser(object): else: return DigikeySearchResponse(1, SearchResponseTypes.NO_MATCHES) + @staticmethod + def ensure_absolute_url(origin_url, url): + if not url.startswith("http"): + o = urllib.parse.urlparse(origin_url) + url = "{}://{}{}".format(o.scheme, o.netloc, url) + return url + class DigikeyRepository(object): def __init__(self, digikey, path): -- cgit v1.2.3