Skip to content

Commit

Permalink
fix url without scheme error, may also fix #8
Browse files Browse the repository at this point in the history
  • Loading branch information
leovan committed Jan 9, 2019
1 parent ee0f390 commit 5f15248
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scihub_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ def get_captcha_info(pdf_captcha_response):
if len(imgs) > 0 and len(ids) > 0:
captcha_id = ids[0].attrib['value']
captcha_img_src = imgs[0].attrib['src']
captcha_img_url = \
urlparse(pdf_captcha_response.url).scheme + '://' + \
captcha_img_url = 'http://' + \
urlparse(pdf_captcha_response.url).netloc + captcha_img_src

return captcha_id, captcha_img_url
Expand Down Expand Up @@ -299,7 +298,7 @@ def fetch_pdf_url(self, query):
iframes = html.xpath('//iframe[@id="pdf"]')

if len(iframes) > 0:
pdf_url = iframes[0].attrib['src']
pdf_url = urlparse(iframes[0].attrib['src'], scheme='http').geturl()
pdf_url_html = '<a href="{pdf_url}">{pdf_url}</a>'.format(pdf_url=pdf_url)

self.log(self.tr('Got PDF URL: ') + pdf_url_html, 'INFO')
Expand Down

0 comments on commit 5f15248

Please sign in to comment.