ta.TwitterDB.create_bat_file_apisearch

TwitterDB.create_bat_file_apisearch(mongoDBServer, mongoDBName, file_path, python_path, consumer_key, consumer_secret, access_token, access_token_secret, query, result_type='mixed', max_count='100', lang='en')[source]

The method will create two files, one python script containing the code necessary to make the requests, and a .bat file that can be used to schedule the call of the python script.

Parameters
  • mongoDBServer – the mongoDB server that will be used to save the tweets

  • mongoDBName – the mongoDB name that will be used to save the tweets

  • file_path – the folder path where the files will be saved

  • python_path – the path where the python.exe is installed

  • 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

Examples

>>> create python script and .bat file for scheduled processing
>>> create_bat_file_apisearch(
>>>         mongoDBServer='mongodb://localhost:27017',
>>>         mongoDBName='myDBName',
>>>         file_path='C:\Data\myScriptsFolder\MyScriptName.py',
>>>         python_path='C:\Users\Me\Anaconda3\envs\myEnv\python.exe',
>>>         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')