twython/twython/helpers.py
Mike Helmick 7cab9d5dd1 Attempting to exclude lines that we can't necessarily hit in tests, added a test, fixed function name
update_profile_background_image has been in endpoints.py twice for a
bit, my bad.

Using update_profile_banner_image for the function name to update
profile banner image (that's what it was called previously)
2013-06-12 10:54:28 -04:00

31 lines
787 B
Python

# -*- coding: utf-8 -*-
"""
twython.helpers
~~~~~~~~~~~~~~~
This module contains functions that are repeatedly used throughout
the Twython library.
"""
from .compat import basestring, numeric_types
def _transparent_params(_params):
params = {}
files = {}
for k, v in _params.items():
if hasattr(v, 'read') and callable(v.read):
files[k] = v # pragma: no cover
elif isinstance(v, bool):
if v:
params[k] = 'true'
else:
params[k] = 'false'
elif isinstance(v, basestring) or isinstance(v, numeric_types):
params[k] = v
elif isinstance(v, list):
params[k] = ','.join(v)
else:
continue # pragma: no cover
return params, files