Streaming tweets
It's time to stream some tweets! Your task is to create the Streamobject and to filter tweets according to particular keywords. tweepy has been imported for you.
Deze oefening maakt deel uit van de cursus
Intermediate Importing Data in Python
Oefeninstructies
- Create your
Streamobject with the credentials given. - Filter your Stream variable for the keywords
"clinton","trump","sanders", and"cruz".
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Store credentials in relevant variables
consumer_key = "nZ6EA0FxZ293SxGNg8g8aP0HM"
consumer_secret = "fJGEodwe3KiKUnsYJC3VRndj7jevVvXbK2D5EiJ2nehafRgA6i"
access_token = "1092294848-aHN7DcRP9B4VMTQIhwqOYiB14YkW92fFO8k8EPy"
access_token_secret = "X4dHmhPfaksHcQ7SCbmZa2oYBBVSD2g8uIHXsp5CTaksx"
# Create your Stream object with credentials
stream = tweepy.Stream(____, ____, ____, ____)
# Filter your Stream variable
stream.filter(____)