Tweepy api binder and python properties
<p>I've been digging around the tweepy source code trying to get a feel for how everything is designed. I'm a little confused with the <code>API</code> class and <code>bind_api</code> function. The tweepy source can be found here: <a href="https://github.com/tweepy/tweepy" rel="nofollow">https://github.com/tweepy/tweepy</a></p>

<p>1) Why is almost every api call a property? What is this actually doing and what benefit does it provide?</p>

<p>2) How is <code>bind_api</code> getting the arguments fed into each api call? For example,</p>

<pre><code>@property
def get_status(self):
    """ :reference: https://dev.twitter.com/rest/reference/get/statuses/show/%3Aid
        :allowed_param:'id'
    """
    return bind_api(
        api=self,
        path='/statuses/show.json',
        payload_type='status',
        allowed_param=['id']
    )
</code></pre>

<p><code>get_status</code> takes no arguments in its definition, but calling api.get_status(id='123') works fine. I'm curious what is happening here. I assume this relates to my first question.</p>

<p>3) Following this same format tweepy is using with <code>bind_api</code>, how can one get the keyword arguments that are fed to an api call? For example if I want to just print "No id supplied" when no <code>id='value'</code> keyword is supplied to <code>get_status</code>, how would I go about that?</p>

<p>Thanks for any help. Hopefully I was clear enough.</p>

<p>I was not thinking when I asked this the other day.</p>

<p><code>bind_api</code> is returning a function. This function is then called when that property is called. That is why each api call is a <code>@property</code> which also answers my second question.</p>

python tweepy