Commit 539c5244 authored by rdecoupe's avatar rdecoupe
Browse files

exception handling

parent 629cf088
......@@ -7,13 +7,36 @@ Connect to Twitter stream using Twitter API and filter tweets which have to be r
To install and run this script : please follow instructions from
try :
import tweepy
import sys
def exitscript():
print("The program encountered an error.\nEnd of execution")
import credentials
except ImportError:
print('it seems there is no file named :""')
raise ImportError('it seems there is no file named :""')
if __name__ == '__main__':
print("Collect tweets : start")
print("Collect tweets : end")
\ No newline at end of file
# Access and authorize on MOOD twitter Account
auth = tweepy.OAuthHandler(credentials.consumer_key, credentials.consumer_secret)
auth.set_access_token(credentials.access_token, credentials.access_token_secret)
api = tweepy.API(auth)
# Get the User object for twitter...
user = api.get_user('twitter')
except tweepy.TweepError as twe:
print("Wrong credentials: please check ")
except Exception as e:
print("Please double check :" + e)
print("Collect tweets : end")
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