ta.TwitterDB.search7dayapi

TwitterDB.search7dayapi(consumer_key, consumer_secret, access_token, access_token_secret, query, result_type='mixed', max_count='100', lang='en')[source]

Send requests to the 7-Day search API and save data into MongoDB

Parameters
  • consumer_key – User’s consumer key

  • consumer_secret – User’s consumer secret

  • access_token – User’s access token

  • access_token_secret – User’s access token secret

  • query – The query that will be used to filter the tweets

  • result_type – Options: recent, popular, or mixed

  • max_count – The number of tweets to be returned at a time

  • lang – Language to filter the tweets

Returns

the response received from Twitter, which will contain either the tweets retrieved from the search, or the error message if any

Return type

response

Examples

>>> # send request to 7-day search API
>>> response = myAnalysisObj.search7dayapi(
>>>     consumer_key = '[key]',
>>>     consumer_secret = '[secret]',
>>>     access_token = '[token]',
>>>     access_token_secret = '[token_secret]',
>>>     query = 'austintexas OR atx OR austintx OR atxlife',
>>>     result_type = 'mixed',
>>>     max_count = '100',
>>>     lang = 'en')