Fix missing import
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from . import exceptions
|
||||||
|
|
||||||
class Package:
|
class Package:
|
||||||
"""
|
"""
|
||||||
@@ -210,13 +211,13 @@ class Repository:
|
|||||||
try:
|
try:
|
||||||
resp = requests.get(self.url, headers=req_headers, timeout=60)
|
resp = requests.get(self.url, headers=req_headers, timeout=60)
|
||||||
except requests.exceptions.RequestException as err:
|
except requests.exceptions.RequestException as err:
|
||||||
raise DownloadException(err) from err
|
raise exceptions.DownloadException(err) from err
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
except requests.HTTPError as err:
|
except requests.HTTPError as err:
|
||||||
self.log.error('Error downloading %s: %s', self.url, 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:
|
if resp.status_code == requests.codes.not_modified:
|
||||||
self.log.debug("Packagelist not modified")
|
self.log.debug("Packagelist not modified")
|
||||||
@@ -239,7 +240,7 @@ class Repository:
|
|||||||
repodict = resp.json()
|
repodict = resp.json()
|
||||||
except json.decoder.JSONDecodeError:
|
except json.decoder.JSONDecodeError:
|
||||||
self.log.exception("Failed to parse downloaded repository")
|
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
|
repodict['_headers'] = resp_headers
|
||||||
|
|
||||||
self.set_from_dict(repodict)
|
self.set_from_dict(repodict)
|
||||||
|
Reference in New Issue
Block a user