Handled more error cases gracefully
This commit is contained in:
parent
7d9f8f8d7f
commit
97daaedf6c
10
mytwitter.py
10
mytwitter.py
|
@ -330,14 +330,20 @@ class MyTwitter():
|
||||||
# Name is the name of a pane, with the 'user: ' in place
|
# Name is the name of a pane, with the 'user: ' in place
|
||||||
def check_following(self, name):
|
def check_following(self, name):
|
||||||
screen_name = re.sub('user: ', '', name)
|
screen_name = re.sub('user: ', '', name)
|
||||||
relationship = self.api.ShowFriendships(target_screen_name=screen_name)
|
try:
|
||||||
|
relationship = self.api.ShowFriendships(target_screen_name=screen_name)
|
||||||
|
except HTTPError:
|
||||||
|
return False
|
||||||
return relationship.source.following
|
return relationship.source.following
|
||||||
|
|
||||||
|
|
||||||
# Name is the name of a pane, with the 'user: ' in place
|
# Name is the name of a pane, with the 'user: ' in place
|
||||||
def check_verified(self, name):
|
def check_verified(self, name):
|
||||||
screen_name = re.sub('user: ', '', name)
|
screen_name = re.sub('user: ', '', name)
|
||||||
user = self.api.GetUser(screen_name)
|
try:
|
||||||
|
user = self.api.GetUser(screen_name)
|
||||||
|
except HTTPError:
|
||||||
|
return False
|
||||||
return user.verified
|
return user.verified
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user