All changes made to the library that might affect applications
during upgrade will be listed here.
+
+1.5 -> 1.6
+===========================
++ API methods now allow for kargs that are not listed in the
+ allowed_params list. This way Tweepy can support future parameters
+ twitter adds without having the patch the library.
+
1.4 -> 1.5
===========================
+ Models
headers = kargs.pop('headers', {})
# build parameter dict
- if allowed_param:
- parameters = {}
- for idx, arg in enumerate(args):
- if isinstance(arg, unicode):
- arg = arg.encode('utf-8')
- elif not isinstance(arg, str):
- arg = str(arg)
+ parameters = {}
+ for idx, arg in enumerate(args):
+ if isinstance(arg, unicode):
+ arg = arg.encode('utf-8')
+ elif not isinstance(arg, str):
+ arg = str(arg)
- try:
- parameters[allowed_param[idx]] = arg
- except IndexError:
- raise TweepError('Too many parameters supplied!')
- for k, arg in kargs.items():
- if arg is None:
- continue
- if k in parameters:
- raise TweepError('Multiple values for parameter %s supplied!' % k)
- if k not in allowed_param:
- raise TweepError('Invalid parameter %s supplied!' % k)
-
- if isinstance(arg, unicode):
- arg = arg.encode('utf-8')
- elif not isinstance(arg, str):
- arg = str(arg)
- parameters[k] = arg
- else:
- if len(args) > 0 or len(kargs) > 0:
- raise TweepError('This method takes no parameters!')
- parameters = None
+ try:
+ parameters[allowed_param[idx]] = arg
+ except IndexError:
+ raise TweepError('Too many parameters supplied!')
+ for k, arg in kargs.items():
+ if arg is None:
+ continue
+ if k in parameters:
+ raise TweepError('Multiple values for parameter %s supplied!' % k)
+
+ if isinstance(arg, unicode):
+ arg = arg.encode('utf-8')
+ elif not isinstance(arg, str):
+ arg = str(arg)
+ parameters[k] = arg
# Pick correct URL root to use
if search_api is False:
api_root = api.search_root
# Build the request URL
- if parameters:
+ if len(parameters):
# Replace any template variables in path
tpath = str(path)
for template in re_path_template.findall(tpath):