Deck 13: Data Mining Twitter
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/15
Play
Full screen (f)
Deck 13: Data Mining Twitter
1
Which of the following statements is false?
A) The API method user_timeline returns tweets from the xe "Twitter:timeline"xe "timeline (Twitter)"timeline of a specific account. A timeline includes that account's tweets and tweets from that account's friends.
B) Method xe "API class (Tweepy):user_timeline method"xe "user_timeline method of class API"user_timeline returns Status objects with each one representing a tweet. Each Status's user property refers to a tweepy.models.User object containing information about the user who sent that tweet, such as that user's screen_name.
C) A Status's text property contains the tweet's text. The following code displays the screen_name and text for three tweets from @nasa:
Nasa_tweets = api.user_timeline(screen_name='nasa', count=3)
For tweet in nasa_tweets:
Print(f'{tweet.user.screen_name}: {tweet.text}\n')
D) If you wish to get more than the maximum number of tweets per call (200), then you should use a Status object to call user_timeline.
A) The API method user_timeline returns tweets from the xe "Twitter:timeline"xe "timeline (Twitter)"timeline of a specific account. A timeline includes that account's tweets and tweets from that account's friends.
B) Method xe "API class (Tweepy):user_timeline method"xe "user_timeline method of class API"user_timeline returns Status objects with each one representing a tweet. Each Status's user property refers to a tweepy.models.User object containing information about the user who sent that tweet, such as that user's screen_name.
C) A Status's text property contains the tweet's text. The following code displays the screen_name and text for three tweets from @nasa:
Nasa_tweets = api.user_timeline(screen_name='nasa', count=3)
For tweet in nasa_tweets:
Print(f'{tweet.user.screen_name}: {tweet.text}\n')
D) If you wish to get more than the maximum number of tweets per call (200), then you should use a Status object to call user_timeline.
B
2
Which of the following statements is false?
A) Twitter's APIs are xe "cloud"cloud-based web services, so an Internet connection is required. Web services are methods that you call in the cloud.
B) Each API method has a web service endpoint, which is represented by a URL that's used to invoke that method over the Internet.
C) Most API methods have rate limits that restrict the number of times you can use them in 15-minute intervals.
D) All of the above statements are true.
A) Twitter's APIs are xe "cloud"cloud-based web services, so an Internet connection is required. Web services are methods that you call in the cloud.
B) Each API method has a web service endpoint, which is represented by a URL that's used to invoke that method over the Internet.
C) Most API methods have rate limits that restrict the number of times you can use them in 15-minute intervals.
D) All of the above statements are true.
A
3
Which of the following statements a) b) or c) is false?
A) Once you have a Twitter developer account, you must obtain credentials for interacting with the Twitter APIs.
B) To use the Twitter APIs, you first create an app.
C) Once you create an app and get a set of credentials, you reuse those credentials for all apps you create.
D) Each of the above statements is true.
A) Once you have a Twitter developer account, you must obtain credentials for interacting with the Twitter APIs.
B) To use the Twitter APIs, you first create an app.
C) Once you create an app and get a set of credentials, you reuse those credentials for all apps you create.
D) Each of the above statements is true.
C
4
Which of the following statements a) b) or c) is false?
A) Hundreds of billions of tweets are sent every day with many millions sent per second.
B) Tweeters with the largest followings are typically entertainers and politicians.
C) Developers can tap into the live stream of tweets as they're happening. This has been likened toxe "data mining" "drinking from a fire hose," because the tweets come at you so quickly.
D) All of the above statements are true.
A) Hundreds of billions of tweets are sent every day with many millions sent per second.
B) Tweeters with the largest followings are typically entertainers and politicians.
C) Developers can tap into the live stream of tweets as they're happening. This has been likened toxe "data mining" "drinking from a fire hose," because the tweets come at you so quickly.
D) All of the above statements are true.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following statements a) b) or c) is false?
A) After authenticating with Twitter, you can use the Tweepy API object's get_user method to get a tweepy.models.User object containing information about a user's Twitter account. The following code gets a User object for NASA's @nasa Twitter account:
Nasa = api.get_user('nasa')
B) Each Twitter method you call through Tweepy has a rate limit.
C) The tweepy.models classes each correspond to the JSON that Twitter returns. For example, the User class corresponds to a Twitter user object. Each tweepy.models class has a method that reads the JSON and turns it into an object of the corresponding Tweepy class.
D) All of the above statements are true.
A) After authenticating with Twitter, you can use the Tweepy API object's get_user method to get a tweepy.models.User object containing information about a user's Twitter account. The following code gets a User object for NASA's @nasa Twitter account:
Nasa = api.get_user('nasa')
B) Each Twitter method you call through Tweepy has a rate limit.
C) The tweepy.models classes each correspond to the JSON that Twitter returns. For example, the User class corresponds to a Twitter user object. Each tweepy.models class has a method that reads the JSON and turns it into an object of the corresponding Tweepy class.
D) All of the above statements are true.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following statements is false?
A) You can use Tweepy to authenticate with Twitter and create a Tweepy API object, which is your gateway to using the Twitter APIs over the Internet.
B) Before you can invoke any Twitter API, you must use your xe "Twitter API:API key"xe "API key (Twitter)"API key and xe "Twitter API:API secret key"xe "API secret key (Twitter)"API secret key to authenticate with Twitter.
C) You can import any .py file as a module by using the file's name without the .py extension in an import statement.
D) When you import keys.py as a module, you can individually access each of the four variables defined in that file as keys.variable_name.
A) You can use Tweepy to authenticate with Twitter and create a Tweepy API object, which is your gateway to using the Twitter APIs over the Internet.
B) Before you can invoke any Twitter API, you must use your xe "Twitter API:API key"xe "API key (Twitter)"API key and xe "Twitter API:API secret key"xe "API secret key (Twitter)"API secret key to authenticate with Twitter.
C) You can import any .py file as a module by using the file's name without the .py extension in an import statement.
D) When you import keys.py as a module, you can individually access each of the four variables defined in that file as keys.variable_name.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following statements a), b) or c) is false?
A) The User object's status property returns a tweepy.models.Status object, which corresponds to a Twitter tweet object. The Status object's text property contains the text of the account's most recent tweet.
B) The text property was originally for tweets up to 140 characters. When Twitter increased the limit to 280 characters, they added an extended_tweet property for accessing the text and other information from tweets between 141 and 280 characters.
C) Retweeting sends the characters exactly as they are received in the original tweet.
D) All of the above statements are true.
A) The User object's status property returns a tweepy.models.Status object, which corresponds to a Twitter tweet object. The Status object's text property contains the text of the account's most recent tweet.
B) The text property was originally for tweets up to 140 characters. When Twitter increased the limit to 280 characters, they added an extended_tweet property for accessing the text and other information from tweets between 141 and 280 characters.
C) Retweeting sends the characters exactly as they are received in the original tweet.
D) All of the above statements are true.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
8
The following code creates an xe "Tweepy library:API class "xe "API class (Tweepy)"API object that you can use to interact with Twitter: api = tweepy.API(auth, wait_on_rate_limit=True,
Wait_on_rate_limit_notify=True)
We specified three arguments in this call to the API xe "constructor"constructor. Which of the following statements a) b) or c) is false?
A) auth is the OAuthHandler object containing your credentials.
B) The keyword argument xe "Tweepy library:wait_on_rate_limit"xe "wait_on_rate_limit (Tweepy)"wait_on_rate_limit=True tells Tweepy to wait 15 minutes each time it reaches a given API method's xe "Twitter API:rate limit"xe "rate limit (Twitter API)"rate limit. This ensures that you do not violate Twitter's rate-limit restrictions.
C) The keyword argument xe "Tweepy library:wait_on_rate_limit_notify"xe "wait_on_rate_limit_notify (Tweepy)"wait_on_rate_limit_notify=True tells Tweepy that, if it needs to wait due to rate limits, it should notify you by displaying a message at the command line.
D) All of the above statements are true.
Wait_on_rate_limit_notify=True)
We specified three arguments in this call to the API xe "constructor"constructor. Which of the following statements a) b) or c) is false?
A) auth is the OAuthHandler object containing your credentials.
B) The keyword argument xe "Tweepy library:wait_on_rate_limit"xe "wait_on_rate_limit (Tweepy)"wait_on_rate_limit=True tells Tweepy to wait 15 minutes each time it reaches a given API method's xe "Twitter API:rate limit"xe "rate limit (Twitter API)"rate limit. This ensures that you do not violate Twitter's rate-limit restrictions.
C) The keyword argument xe "Tweepy library:wait_on_rate_limit_notify"xe "wait_on_rate_limit_notify (Tweepy)"wait_on_rate_limit_notify=True tells Tweepy that, if it needs to wait due to rate limits, it should notify you by displaying a message at the command line.
D) All of the above statements are true.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
9
Which of the following statements a) b) or c) is false?
A) Each Twitter API method's documentation discusses the maximum number of items the method can return in one call-this is known as
B) When you request more results than a given method can return, Twitter's JSON responses indicate that there are more pages to get. Tweepy's Cursor class handles these details for you.
C) A Cursor invokes a specified method and checks whether Twitter indicated that there is anothe
D) If you configure the API object to wait when rate limits are reached, the Cursor will adhere to the rate limits and wait as needed between calls.
A) Each Twitter API method's documentation discusses the maximum number of items the method can return in one call-this is known as
B) When you request more results than a given method can return, Twitter's JSON responses indicate that there are more pages to get. Tweepy's Cursor class handles these details for you.
C) A Cursor invokes a specified method and checks whether Twitter indicated that there is anothe
D) If you configure the API object to wait when rate limits are reached, the Cursor will adhere to the rate limits and wait as needed between calls.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the following statements is false?
A) The Twitter API methods return JSON (JavaScript Object Notation) objects. JSON is a text-based data-interchange format used to represent objects as collections of name-value pairs.
B) JSON is both a human-readable and computer-readable format that makes data easy to send and receive across the Internet. It's commonly used when invoking web services.
C) xe "JSON (JavaScript Object Notation):object"JSON objects are similar to Python dictionaries. Each xe "JSON (JavaScript Object Notation):object"JSON object contains a list of property names and values, in the following curly braced format: {propertyName1: value1, propertyName2: value2}
D) JSON arrays are comma-separated values in parentheses: (value1, value2, value3)
A) The Twitter API methods return JSON (JavaScript Object Notation) objects. JSON is a text-based data-interchange format used to represent objects as collections of name-value pairs.
B) JSON is both a human-readable and computer-readable format that makes data easy to send and receive across the Internet. It's commonly used when invoking web services.
C) xe "JSON (JavaScript Object Notation):object"JSON objects are similar to Python dictionaries. Each xe "JSON (JavaScript Object Notation):object"JSON object contains a list of property names and values, in the following curly braced format: {propertyName1: value1, propertyName2: value2}
D) JSON arrays are comma-separated values in parentheses: (value1, value2, value3)
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the following statements a) b) or c) is false?
A) Twitter has become a favorite big data source for researchers and business people worldwide. Through special arrangements with Twitter, some third-party businesses (and Twitter itself) offer paid access to much larger portions the all-time tweets database.
B) You can't always trust everything you read on the Internet, and tweets are no exception. For example, people might use false information to try to manipulate financial markets or influence political elections. That's one of the challenges of building business-critical and mission-critical systems based on social media content.
C) We can program with the same reliability as desktop apps when using web services.
D) Each of the above statements is true.
A) Twitter has become a favorite big data source for researchers and business people worldwide. Through special arrangements with Twitter, some third-party businesses (and Twitter itself) offer paid access to much larger portions the all-time tweets database.
B) You can't always trust everything you read on the Internet, and tweets are no exception. For example, people might use false information to try to manipulate financial markets or influence political elections. That's one of the challenges of building business-critical and mission-critical systems based on social media content.
C) We can program with the same reliability as desktop apps when using web services.
D) Each of the above statements is true.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
12
Which of the following statements about User object properties is true?
A) The id property is the account ID number you create for yourself when you join Twitter.
B) The name property is the name associated with the user's Twitter handle (such as @nasa).
C) The name and screen_name must be real names.
D) All of the above statements are false.
A) The id property is the account ID number you create for yourself when you join Twitter.
B) The name property is the name associated with the user's Twitter handle (such as @nasa).
C) The name and screen_name must be real names.
D) All of the above statements are false.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
13
A term commonly used to mean the hundreds of millions of users who have anything to do with sending, receiving and analyzing tweets is the ________.
A) Twitterverse
B) Twitterorb
C) Twitterglobe
D) Twitterearth
A) Twitterverse
B) Twitterorb
C) Twitterglobe
D) Twitterearth
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
14
Which of the following statements is false?
A) Data mining is the process of searching through large collections of data, often big data, to find insights that can be valuable to individuals and organizations.
B) You connect to Twitter via web services.
C) You can use Twitter's Streaming API to tap into the enormous base of past tweets and its Search API to sample the flood of new tweets as they happen.
D) Because of powerful libraries, you'll often perform significant tasks with just a few lines of code.
A) Data mining is the process of searching through large collections of data, often big data, to find insights that can be valuable to individuals and organizations.
B) You connect to Twitter via web services.
C) You can use Twitter's Streaming API to tap into the enormous base of past tweets and its Search API to sample the flood of new tweets as they happen.
D) Because of powerful libraries, you'll often perform significant tasks with just a few lines of code.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck
15
Which of the following statements a) b) or c) is false?
A) Each Twitter API method has a rate limit, which is the maximum number of requests (that is, calls) you can make during a 15-minute window. Some methods list both xe "Twitter API:user rate limit"xe "user rate limit (Twitter API)"user rate limits and xe "Twitter API:app rate limit"xe "app rate limit (Twitter API)"app rate limits.
B) Twitter may block you from using its APIs if you continue to call a given API method after that method's rate limit has been reached.
C) You can configure Tweepy to wait when it encounters rate limits. This helps prevent you from exceeding the rate-limit restrictions.
D) All of the above statements are true.
A) Each Twitter API method has a rate limit, which is the maximum number of requests (that is, calls) you can make during a 15-minute window. Some methods list both xe "Twitter API:user rate limit"xe "user rate limit (Twitter API)"user rate limits and xe "Twitter API:app rate limit"xe "app rate limit (Twitter API)"app rate limits.
B) Twitter may block you from using its APIs if you continue to call a given API method after that method's rate limit has been reached.
C) You can configure Tweepy to wait when it encounters rate limits. This helps prevent you from exceeding the rate-limit restrictions.
D) All of the above statements are true.
Unlock Deck
Unlock for access to all 15 flashcards in this deck.
Unlock Deck
k this deck