From 7eac1d3e2c3b139cbc04061876d36a497c66d3e1 Mon Sep 17 00:00:00 2001 From: Josh Roesslein Date: Thu, 6 Aug 2009 22:08:25 -0500 Subject: [PATCH] Added support for non-keyword parameters. --- tweepy/binder.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tweepy/binder.py b/tweepy/binder.py index fe66c7b..b2faf16 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -16,9 +16,18 @@ def bind_api(path, parser, allowed_param=None, method='GET', require_auth=False, if not api.auth_handler: raise TweepError('Authentication required!') - # Filter out unallowed parameters + # build parameter dict if allowed_param: - parameters = dict((k,v) for k,v in kargs.items() if k in allowed_param) + parameters = {} + for idx, arg in enumerate(args): + try: + parameters[allowed_param[idx]] = arg + except IndexError: + raise TweepError('Too many parameters supplied!') + for k, arg in kargs.items(): + if k in parameters: + raise TweepError('Multiple values for parameter %s supplied!' % k) + parameters[k] = arg else: parameters = None @@ -54,9 +63,9 @@ def bind_api(path, parser, allowed_param=None, method='GET', require_auth=False, # Open connection if api.secure: - conn = httplib.HTTPSConnection(_host) + conn = httplib.HTTPSConnection(_host, timeout=10) else: - conn = httplib.HTTPConnection(_host) + conn = httplib.HTTPConnection(_host, timeout=10) # Build request conn.request(method, url, headers=headers) -- 2.25.1