if allowed_param:
parameters = {}
for idx, arg in enumerate(args):
- encoded_arg = arg.encode('utf-8') # must encode parameters to utf-8
+ if isinstance(arg, unicode):
+ arg = arg.encode('utf-8')
try:
- parameters[allowed_param[idx]] = encoded_arg
+ parameters[allowed_param[idx]] = arg
except IndexError:
raise TweepError('Too many parameters supplied!')
for k, arg in kargs.items():
raise TweepError('Multiple values for parameter %s supplied!' % k)
if k not in allowed_param:
raise TweepError('Invalid parameter %s supplied!' % k)
- parameters[k] = arg.encode('utf-8')
+ if isinstance(arg, unicode):
+ arg = arg.encode('utf-8')
+ parameters[k] = arg
else:
if len(args) > 0 or len(kargs) > 0:
raise TweepError('This method takes no parameters!')