mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
lpapicache: replace httplib2 use with call to download_text()
Signed-off-by: Dan Streetman <ddstreet@canonical.com>
This commit is contained in:
parent
b89ad962f4
commit
359cb18d8d
@ -21,10 +21,6 @@
|
|||||||
#
|
#
|
||||||
# Based on code written by Jonathan Davies <jpds@ubuntu.com>
|
# Based on code written by Jonathan Davies <jpds@ubuntu.com>
|
||||||
|
|
||||||
# Uncomment for tracing LP API calls
|
|
||||||
# import httplib2
|
|
||||||
# httplib2.debuglevel = 1
|
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -32,15 +28,16 @@ import re
|
|||||||
from copy import copy
|
from copy import copy
|
||||||
|
|
||||||
from debian.changelog import Changelog
|
from debian.changelog import Changelog
|
||||||
from httplib2 import Http, HttpLib2Error
|
|
||||||
from launchpadlib.launchpad import Launchpad as LP
|
from launchpadlib.launchpad import Launchpad as LP
|
||||||
from launchpadlib.errors import HTTPError
|
from launchpadlib.errors import HTTPError
|
||||||
from lazr.restfulclient.resource import Entry
|
from lazr.restfulclient.resource import Entry
|
||||||
|
from urllib.error import URLError
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from ubuntutools.version import Version
|
from ubuntutools.version import Version
|
||||||
from ubuntutools.lp import (service, api_version)
|
from ubuntutools.lp import (service, api_version)
|
||||||
from ubuntutools.misc import (host_architecture,
|
from ubuntutools.misc import (download_text,
|
||||||
|
host_architecture,
|
||||||
DEFAULT_POCKETS, POCKETS,
|
DEFAULT_POCKETS, POCKETS,
|
||||||
DEFAULT_STATUSES, STATUSES)
|
DEFAULT_STATUSES, STATUSES)
|
||||||
from ubuntutools.lp.udtexceptions import (AlreadyLoggedInError,
|
from ubuntutools.lp.udtexceptions import (AlreadyLoggedInError,
|
||||||
@ -850,14 +847,10 @@ class SourcePackagePublishingHistory(BaseWrapper):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response, changelog = Http().request(url)
|
self._changelog = download_text(url)
|
||||||
except HttpLib2Error as e:
|
except URLError as e:
|
||||||
Logger.error(str(e))
|
Logger.error(f"Exception while downloading '{url}': {e}")
|
||||||
return None
|
return None
|
||||||
if response.status != 200:
|
|
||||||
Logger.error('%s: %s %s' % (url, response.status, response.reason))
|
|
||||||
return None
|
|
||||||
self._changelog = changelog
|
|
||||||
|
|
||||||
if since_version is None:
|
if since_version is None:
|
||||||
return self._changelog
|
return self._changelog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user