From ab03e18ce22343d0b6f9eb602742bff6ee1a352d Mon Sep 17 00:00:00 2001 From: Maks Snegov Date: Sun, 22 Jun 2014 11:48:04 +0400 Subject: [PATCH] fix relative urls --- nevernote.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nevernote.py b/nevernote.py index 87e99c8..1796713 100755 --- a/nevernote.py +++ b/nevernote.py @@ -35,7 +35,7 @@ def download_content(url, depth=0): raise InfiniteRedirects('too much redirects: %s' % url) up = urlparse(url) - if not up.scheme: + if not up.netloc: up = urlparse('//' + url) headers = { @@ -44,7 +44,7 @@ def download_content(url, depth=0): "Connection": "keep-alive", } - if up.scheme == 'http': + if not up.scheme or up.scheme == 'http': conn = http.client.HTTPConnection(up.netloc) elif up.scheme == 'https': conn = http.client.HTTPSConnection(up.netloc)