Skip to content

Commit

Permalink
changes for twitterdetails - exception occurs when the user has been …
Browse files Browse the repository at this point in the history
…suspended from twitter and terminates the program from running the rest of it
  • Loading branch information
ishamfazal committed Jan 9, 2018
1 parent 71d1481 commit 41bd014
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions username/username_twitterdetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ def twitterdetails(username):

# preparing auth
api = tweepy.API(auth)

userinfo = api.get_user(screen_name=username)

userdetails = {}
activitydetails = {}
try:
userinfo = api.get_user(screen_name=username)
except Exception as e:
if e.message[0]['code'] == 63:
print colored(style.BOLD + '[!] Error: ' + str(e.message[0]['message']) + style.END, 'red')
pass
return activitydetails, userdetails

userdetails['Followers'] = userinfo.followers_count
userdetails['Following'] = userinfo.friends_count
userdetails['Geolocation Enabled'] = userinfo.geo_enabled
Expand Down Expand Up @@ -110,7 +116,7 @@ def output(data, username=""):
print colored(
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')
else:
if data:
if data and data[0]:
hashlist = data[0]['Hashtag Interactions']
userlist = data[0]['User Interactions']
userdetails = data[1]
Expand Down

0 comments on commit 41bd014

Please sign in to comment.