From: Alejandro Gómez Date: Thu, 5 Jul 2012 19:32:30 +0000 (+0200) Subject: Add missing parameters to `verify_credentials` X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8e5adbea75a84c11b0d76052fb9f5e82c675f369;p=tweepy.git Add missing parameters to `verify_credentials` As described in the Twitter API docs, the `verify_credentials` method accepts the optional `include_entities` and `skip_status` parameters. https://dev.twitter.com/docs/api/1/get/account/verify_credentials I've modified `tweepy.API.verify_credentials` for allowing these parameters and expanded `tests.testverifycredentials` to test the new functionality --- diff --git a/tests.py b/tests.py index 4929cd3..3905c6b 100644 --- a/tests.py +++ b/tests.py @@ -130,6 +130,14 @@ class TweepyAPITests(unittest.TestCase): def testverifycredentials(self): self.assertNotEqual(self.api.verify_credentials(), False) + # make sure that `me.status.entities` is not an empty dict + me = self.api.verify_credentials(include_entities=True) + self.assertTrue(me.status.entities) + + # `status` shouldn't be included + me = self.api.verify_credentials(skip_status=True) + self.assertFalse(hasattr(me, 'status')) + api = API(BasicAuthHandler('bad', 'password')) self.assertEqual(api.verify_credentials(), False) diff --git a/tweepy/api.py b/tweepy/api.py index 7692ce4..c6bd5d0 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -307,13 +307,14 @@ class API(object): ) """ account/verify_credentials """ - def verify_credentials(self): + def verify_credentials(self, **kargs): try: return bind_api( path = '/account/verify_credentials.json', payload_type = 'user', - require_auth = True - )(self) + require_auth = True, + allowed_param = ['include_entities', 'skip_status'], + )(self, **kargs) except TweepError, e: if e.response and e.response.status == 401: return False