From: Josh Roesslein Date: Tue, 13 Oct 2009 22:39:01 +0000 (-0500) Subject: Some binder optimizations. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8fd79bab1462f828e038c98f7012202e7c8cd37f;p=tweepy.git Some binder optimizations. --- diff --git a/tweepy/binder.py b/tweepy/binder.py index 0088501..52ad01e 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -29,31 +29,15 @@ def bind_api(path, parser, allowed_param=[], method='GET', require_auth=False, if require_auth and not api.auth_handler: raise TweepError('Authentication required!') - # check for post_data parameter - if 'post_data' in kargs: - post_data = kargs['post_data'] - del kargs['post_data'] - else: - post_data = None + # check for post data + post_data = kargs.pop('post_data', None) # check for retry request parameters - if 'retry_count' in kargs: - retry_count = kargs['retry_count'] - del kargs['retry_count'] - else: - retry_count = 0 - if 'retry_delay' in kargs: - retry_delay = kargs['retry_delay'] - del kargs['retry_delay'] - else: - retry_delay = 0 + retry_count = kargs.pop('retry_count', 0) + retry_delay = kargs.pop('retry_delay', 0) # check for headers - if 'headers' in kargs: - headers = dict(kargs['headers']) - del kargs['headers'] - else: - headers = {} + headers = kargs.pop('headers', {}) # build parameter dict if allowed_param: