Skip to main content

Stream Tweets into Your Favorite Databases

Project description

twimer

Stream Tweets into Your Favorite Databases

Analyzing tweets can reveal very interesting information about events in a specific time, people's opinions about the news, etc. We, therefore, aim to make the data collection easier for you so you can focus on your analysis!

The goal of this project is to make collecting Twitter data easier. This is a wrapper for Tweepy Stream which help you store tweets with certain keywords and from specific geographic regions into JSON files for database systems.

Twitter API

To use this project, you need to obtain CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET from Twitter Developer

Installation

You can simply install this package by running the following command:

pip install twimer 

Usage

In the current version, you can stream the tweets using their keywords and store them in files (JSON and JSON.tar.gz) and MongoDB databases.

To store the tweets as JSON files in my_path directory:

import twimer

stream_tweet = twimer.Twimer(CONSUMER_KEY, 
                             CONSUMER_SECRET, 
                             ACCESS_TOKEN, 
                             ACCESS_TOKEN_SECRET, 
                             storage_method='file/json', 
                             file_path=my_path)
stream_tweet.start_streaming(filters=['keyword1', 'keyword2'])

And to store the tweets in a MongoDB database using url my_url

import twimer

stream_tweet = twimer.Twimer(CONSUMER_KEY, 
                             CONSUMER_SECRET, 
                             ACCESS_TOKEN, 
                             ACCESS_TOKEN_SECRET, 
                             storage_method='mongodb', 
                             mongo_url=mongo_url)
stream_tweet.start_streaming(filters=['keyword1', 'keyword2'])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Twimer-0.0.1.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

Twimer-0.0.1-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page