Some binder optimizations.
authorJosh Roesslein <jroesslein@gmail.com>
Tue, 13 Oct 2009 22:39:01 +0000 (17:39 -0500)
committerJosh Roesslein <jroesslein@gmail.com>
Tue, 13 Oct 2009 22:39:01 +0000 (17:39 -0500)
tweepy/binder.py

index 008850110ed8ab1a1d81aae9e9a830a970ea5b70..52ad01e43b61f379ebcc0666466952a1bb5cf44b 100644 (file)
@@ -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: