Commit 8e5adbea authored by Alejandro Gómez's avatar Alejandro Gómez
Browse files

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
parent aa6a31d5
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment