Fix missing import

This commit is contained in:
Ellwood Zwovic
2017-07-24 14:17:06 -07:00
parent f110661e12
commit 6f8810f6d1

View File

@@ -1,6 +1,7 @@
import logging
import json
from pathlib import Path
from . import exceptions
class Package:
"""
@@ -210,13 +211,13 @@ class Repository:
try:
resp = requests.get(self.url, headers=req_headers, timeout=60)
except requests.exceptions.RequestException as err:
raise DownloadException(err) from err
raise exceptions.DownloadException(err) from err
try:
resp.raise_for_status()
except requests.HTTPError as err:
self.log.error('Error downloading %s: %s', self.url, err)
raise DownloadException(resp.status_code, resp.reason) from err
raise exceptions.DownloadException(resp.status_code, resp.reason) from err
if resp.status_code == requests.codes.not_modified:
self.log.debug("Packagelist not modified")
@@ -239,7 +240,7 @@ class Repository:
repodict = resp.json()
except json.decoder.JSONDecodeError:
self.log.exception("Failed to parse downloaded repository")
raise DownloadException("Could not parse repository downloaded from '%s'. Are you sure this is the correct URL?" % self.url)
raise exceptions.DownloadException("Could not parse repository downloaded from '%s'. Are you sure this is the correct URL?" % self.url)
repodict['_headers'] = resp_headers
self.set_from_dict(repodict)