From aa72b293d788680f1e794d2f86d92ce72583803c Mon Sep 17 00:00:00 2001 From: Brandon Shelley Date: Mon, 1 Jan 2018 21:05:17 -0800 Subject: [PATCH 1/2] Fix #35 - bool typed params are not passed correctly This does a simple check that looks for `bool` typed params and converts them to string values in lowercase. --- tmdbsimple/base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tmdbsimple/base.py b/tmdbsimple/base.py index 416146f..03ca2d7 100644 --- a/tmdbsimple/base.py +++ b/tmdbsimple/base.py @@ -64,6 +64,10 @@ def _get_params(self, params): api_dict = {'api_key': API_KEY} if params: params.update(api_dict) + for key, value in params.iteritems(): + if isinstance(params[key], bool): + params[key] = 'true' if value else 'false' + else: params = api_dict return params From 3f5b6ec82a2584a8131b47da3dbd8e6bb5d2f3f5 Mon Sep 17 00:00:00 2001 From: Brandon Shelley Date: Tue, 2 Jan 2018 12:00:14 -0800 Subject: [PATCH 2/2] Change iteritems() to 2/3 compat, check bool param is True - iteritems() is only py2 compatible, changing to items(), although inefficient, should be fine for this and does not require importing future - Add a verbose check to ensure bool type param is True --- tmdbsimple/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmdbsimple/base.py b/tmdbsimple/base.py index 03ca2d7..cb0386f 100644 --- a/tmdbsimple/base.py +++ b/tmdbsimple/base.py @@ -64,9 +64,9 @@ def _get_params(self, params): api_dict = {'api_key': API_KEY} if params: params.update(api_dict) - for key, value in params.iteritems(): + for key, value in params.items(): if isinstance(params[key], bool): - params[key] = 'true' if value else 'false' + params[key] = 'true' if value is True else 'false' else: params = api_dict