summaryrefslogtreecommitdiff
path: root/src/leap/keymanager
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-08-08 23:37:37 +0200
committerdrebs <drebs@leap.se>2013-08-08 23:37:37 +0200
commit8a66bf5912e1090ca90ca2b4e8cc1ef129e8ac79 (patch)
treeb2c36e9857453fe2934489b68c8e9e6f6ab6a090 /src/leap/keymanager
parentf2eeb227d272f00d7d96f14b1f178656112f3292 (diff)
parent1eebbfcad803f25681f777c70f97602e2ef295f0 (diff)
Merge branch 'bug/support_nicknym_potential_problems' into develop
Diffstat (limited to 'src/leap/keymanager')
-rw-r--r--src/leap/keymanager/__init__.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/leap/keymanager/__init__.py b/src/leap/keymanager/__init__.py
index d24e08e4..e6122ffb 100644
--- a/src/leap/keymanager/__init__.py
+++ b/src/leap/keymanager/__init__.py
@@ -20,6 +20,7 @@
Key Manager is a Nicknym agent for LEAP client.
"""
+import logging
import requests
from leap.common.check import leap_assert, leap_assert_type
@@ -38,6 +39,8 @@ from leap.keymanager.openpgp import (
OpenPGPScheme,
)
+logger = logging.getLogger(__name__)
+
#
# The Key Manager
@@ -170,12 +173,18 @@ class KeyManager(object):
@raise KeyNotFound: If the key was not found on nickserver.
"""
# request keys from the nickserver
- server_keys = self._get(
- self._nickserver_uri, {'address': address}).json()
- # insert keys in local database
- if self.OPENPGP_KEY in server_keys:
- self._wrapper_map[OpenPGPKey].put_ascii_key(
- server_keys['openpgp'])
+ res = None
+ try:
+ res = self._get(self._nickserver_uri, {'address': address})
+ server_keys = res.json()
+ # insert keys in local database
+ if self.OPENPGP_KEY in server_keys:
+ self._wrapper_map[OpenPGPKey].put_ascii_key(
+ server_keys['openpgp'])
+ except Exception as e:
+ logger.warning("Error retrieving the keys: %r" % (e,))
+ if res:
+ logger.warning("%s" % (res.content,))
#
# key management