def __init__( self, limit=2000, upper_date_limit=None, lower_date_limit=None, fprefix='tweets', subdir='twitter-files', repeat=False, gzip_compress=False, ): """ The difference between the upper and lower date limits depends on whether Tweets are coming in an ascending date order (i.e. when streaming) or descending date order (i.e. when searching past Tweets). :param int limit: number of data items to process in the current\ round of processing. :param tuple upper_date_limit: The date at which to stop collecting new\ data. This should be entered as a tuple which can serve as the\ argument to `datetime.datetime`. E.g. `upper_date_limit=(2015, 4, 1, 12,\ 40)` for 12:30 pm on April 1 2015. :param tuple lower_date_limit: The date at which to stop collecting new\ data. See `upper_data_limit` for formatting. :param str fprefix: The prefix to use in creating file names for Tweet\ collections. :param str subdir: The name of the directory where Tweet collection\ files should be stored. :param bool repeat: flag to determine whether multiple files should be\ written. If `True`, the length of each file will be set by the value\ of `limit`. See also :py:func:`handle`. :param gzip_compress: if `True`, ouput files are compressed with gzip. """ self.fprefix = fprefix self.subdir = guess_path(subdir) self.gzip_compress = gzip_compress self.fname = self.timestamped_file() self.repeat = repeat self.output = None TweetHandlerI.__init__(self, limit, upper_date_limit, lower_date_limit)
def __init__(self, limit=2000, date_limit=None, stream=True, fprefix='tweets', subdir='twitter-files', repeat=False, gzip_compress=False): """ :param int limit: number of data items to process in the current\ round of processing :param bool stream: If `True`, use the live public stream,\ otherwise search past public Tweets :param str fprefix: The prefix to use in creating file names for Tweet\ collections :param str subdir: The name of the directory where Tweet collection\ files should be stored :param bool repeat: flag to determine whether multiple files should be\ written. If `True`, the length of each file will be set by the value\ of `limit`. See also :py:func:`handle`. :param gzip_compress: if `True`, ouput files are compressed with gzip """ self.fprefix = fprefix self.subdir = guess_path(subdir) self.gzip_compress = gzip_compress self.fname = self.timestamped_file() self.stream = stream self.repeat = repeat # max_id stores the id of the older tweet fetched self.max_id = None self.output = None TweetHandlerI.__init__(self, limit, date_limit)
def __init__( self, limit=2000, upper_date_limit=None, lower_date_limit=None, fprefix="tweets", subdir="twitter-files", repeat=False, gzip_compress=False, ): """ The difference between the upper and lower date limits depends on whether Tweets are coming in an ascending date order (i.e. when streaming) or descending date order (i.e. when searching past Tweets). :param int limit: number of data items to process in the current\ round of processing. :param tuple upper_date_limit: The date at which to stop collecting new\ data. This should be entered as a tuple which can serve as the\ argument to `datetime.datetime`. E.g. `upper_date_limit=(2015, 4, 1, 12,\ 40)` for 12:30 pm on April 1 2015. :param tuple lower_date_limit: The date at which to stop collecting new\ data. See `upper_data_limit` for formatting. :param str fprefix: The prefix to use in creating file names for Tweet\ collections. :param str subdir: The name of the directory where Tweet collection\ files should be stored. :param bool repeat: flag to determine whether multiple files should be\ written. If `True`, the length of each file will be set by the value\ of `limit`. See also :py:func:`handle`. :param gzip_compress: if `True`, ouput files are compressed with gzip. """ self.fprefix = fprefix self.subdir = guess_path(subdir) self.gzip_compress = gzip_compress self.fname = self.timestamped_file() self.repeat = repeat self.output = None TweetHandlerI.__init__(self, limit, upper_date_limit, lower_date_limit)
def __init__( self, limit=2000, date_limit=None, stream=True, fprefix="tweets", subdir="twitter-files", repeat=False, gzip_compress=False, ): """ :param int limit: number of data items to process in the current\ round of processing :param bool stream: If `True`, use the live public stream,\ otherwise search past public Tweets :param str fprefix: The prefix to use in creating file names for Tweet\ collections :param str subdir: The name of the directory where Tweet collection\ files should be stored :param bool repeat: flag to determine whether multiple files should be\ written. If `True`, the length of each file will be set by the value\ of `limit`. See also :py:func:`handle`. :param gzip_compress: if `True`, ouput files are compressed with gzip """ self.fprefix = fprefix self.subdir = guess_path(subdir) self.gzip_compress = gzip_compress self.fname = self.timestamped_file() self.stream = stream self.repeat = repeat # max_id stores the id of the older tweet fetched self.max_id = None self.output = None TweetHandlerI.__init__(self, limit, date_limit)