mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 16:11:15 +00:00
* lpapiwrapper.py:
- Add a check for cached LP API URLs instead of blindly fetching it
This commit is contained in:
parent
adf3557967
commit
d63b782aec
@ -251,7 +251,13 @@ class BaseWrapper(object):
|
|||||||
|
|
||||||
def __new__(cls, data):
|
def __new__(cls, data):
|
||||||
if isinstance(data, str) and data.startswith('https://api.edge.launchpad.net/beta/'):
|
if isinstance(data, str) and data.startswith('https://api.edge.launchpad.net/beta/'):
|
||||||
# looks like a LP API URL, try to get it
|
# looks like a LP API URL
|
||||||
|
# check if it's already cached
|
||||||
|
cached = cls._cache.get(data)
|
||||||
|
if cached:
|
||||||
|
return cached
|
||||||
|
|
||||||
|
# not cached, so try to get it
|
||||||
try:
|
try:
|
||||||
data = Launchpad.load(data)
|
data = Launchpad.load(data)
|
||||||
except HTTPError:
|
except HTTPError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user