diff options
author | Colin Watson <cjwatson@debian.org> | 2017-11-10 15:50:40 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2017-11-10 15:50:40 +0000 |
commit | 949b7072cabce0daed6c94993ad44c8ea8648dbd (patch) | |
tree | f5fd40a612e5e3d861aa4ccc6cc8d2a84485b824 /macaroonbakery | |
parent | 37d61d0415f6cc96a7a9abe057e1ae0f89fd977e (diff) |
Import py-macaroon-bakery_0.0.6.orig.tar.gz
Diffstat (limited to 'macaroonbakery')
-rw-r--r-- | macaroonbakery/httpbakery/agent/agent.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/macaroonbakery/httpbakery/agent/agent.py b/macaroonbakery/httpbakery/agent/agent.py index 862f00e..ad56015 100644 --- a/macaroonbakery/httpbakery/agent/agent.py +++ b/macaroonbakery/httpbakery/agent/agent.py @@ -6,6 +6,7 @@ import json import nacl.public import nacl.encoding +import nacl.exceptions import requests.cookies import six from six.moves.urllib.parse import urlparse @@ -35,8 +36,10 @@ def load_agent_file(filename, cookies=None): with open(filename) as f: data = json.load(f) try: - key = nacl.public.PrivateKey(data['key']['private'], - nacl.encoding.Base64Encoder) + key = nacl.public.PrivateKey( + data['key']['private'], + nacl.encoding.Base64Encoder, + ) if cookies is None: cookies = requests.cookies.RequestsCookieJar() for agent in data['agents']: @@ -54,7 +57,7 @@ def load_agent_file(filename, cookies=None): path=u.path) cookies.set_cookie(cookie) return cookies, key - except (KeyError, ValueError) as e: + except (KeyError, ValueError, nacl.exceptions.TypeError) as e: raise AgentFileFormatError('invalid agent file', e) |