From 32fb204a9c49917cd06e7e8a790c1999aaf9cd43 Mon Sep 17 00:00:00 2001 From: Kyle Mahan Date: Mon, 2 Feb 2015 08:42:38 -0800 Subject: [PATCH] bugfix: list is not an iterator msg when processing errors --- flask_micropub.py | 6 ++++-- setup.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/flask_micropub.py b/flask_micropub.py index 229db46..7011828 100644 --- a/flask_micropub.py +++ b/flask_micropub.py @@ -136,11 +136,13 @@ class MicropubClient: rdata = parse_qs(response.text) if response.status_code != 200: + error_vals = rdata.get('error') + error_descs = rdata.get('error_description') return AuthResponse( next_url=next_url, error='authorization failed. {}: {}'.format( - next(rdata.get('error', []), None), - next(rdata.get('error_description', []), None))) + error_vals[0] if error_vals else 'Unknown Error', + error_descs[0] if error_descs else 'Unknown Error')) if 'me' not in rdata: return AuthResponse( diff --git a/setup.py b/setup.py index c7f7565..105568a 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ from setuptools import setup setup( name='Flask-Micropub', - version='0.1.2', + version='0.1.3', url='https://github.com/kylewm/flask-micropub/', license='BSD', author='Kyle Mahan',