From 7e4d2a4b3bc9b73501d833af349fc8b8986a5197 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 13 Feb 2021 00:14:21 -0600 Subject: [PATCH] Remove handling of 401 HTTP status code in API.verify_credentials --- tests/test_api.py | 2 +- tweepy/api.py | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index 115792d..1e5acc6 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -186,7 +186,7 @@ class TweepyAPITests(TweepyTestCase): @tape.use_cassette('testverifycredentials.json') def testverifycredentials(self): - self.assertNotEqual(self.api.verify_credentials(), False) + self.api.verify_credentials() # make sure that `me.status.entities` is not an empty dict me = self.api.verify_credentials(include_entities=True) diff --git a/tweepy/api.py b/tweepy/api.py index 1c6a3ac..2505654 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -688,16 +688,11 @@ class API: """ if 'include_email' in kwargs: kwargs['include_email'] = str(kwargs['include_email']).lower() - try: - return self.request( - 'GET', 'account/verify_credentials', endpoint_parameters=( - 'include_entities', 'skip_status', 'include_email' - ), **kwargs - ) - except TweepError as e: - if e.response is not None and e.response.status_code == 401: - return False - raise + return self.request( + 'GET', 'account/verify_credentials', endpoint_parameters=( + 'include_entities', 'skip_status', 'include_email' + ), **kwargs + ) @payload('json') def rate_limit_status(self, *args, **kwargs): -- 2.25.1