Skip to content

Commit 8504aee

Browse files
authored
Merge pull request #225 from ishamfazal/issu01-twitter_suspended_user
Suspended user unhandled exception
2 parents d82df97 + 41bd014 commit 8504aee

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

username/username_twitterdetails.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ def twitterdetails(username):
3434

3535
# preparing auth
3636
api = tweepy.API(auth)
37-
38-
userinfo = api.get_user(screen_name=username)
39-
4037
userdetails = {}
38+
activitydetails = {}
39+
try:
40+
userinfo = api.get_user(screen_name=username)
41+
except Exception as e:
42+
if e.message[0]['code'] == 63:
43+
print colored(style.BOLD + '[!] Error: ' + str(e.message[0]['message']) + style.END, 'red')
44+
pass
45+
return activitydetails, userdetails
46+
4147
userdetails['Followers'] = userinfo.followers_count
4248
userdetails['Following'] = userinfo.friends_count
4349
userdetails['Geolocation Enabled'] = userinfo.geo_enabled
@@ -110,7 +116,7 @@ def output(data, username=""):
110116
print colored(
111117
style.BOLD + '\n[-] Twitter API Keys not configured. Skipping Twitter search.\nPlease refer to http://datasploit.readthedocs.io/en/latest/apiGeneration/.\n' + style.END, 'red')
112118
else:
113-
if data:
119+
if data and data[0]:
114120
hashlist = data[0]['Hashtag Interactions']
115121
userlist = data[0]['User Interactions']
116122
userdetails = data[1]

0 commit comments

Comments
 (0)