Skip to main content

Stream feed from Twitter to Azure Event Hub

Project description

# TwitterEventHubFeed
A command line tool that allow to stream feed from Twitter to EventHub.

This project is a fork of the [TwitterCosmosDBFeed]( by [tknandu](

## Pre-requisites
- (1) Registration as a Twitter App
- You need to register the tool as a new application at <>. After choosing a name and application for your app, you will be provided with a *twitter_consumer_key*, *twitter_consumer_secret*, *twitter_access_token* and *twitter_access_token_secret* - which need to be filled into *twitter2eh.json* to provide the app programmatic access to Twitter.
- (2) Create an Event Hub
- You need to create a namespace for the Event Hubs type, and obtain the management credentials that your application needs to communicate with the event hub. To create a namespace and event hub, follow the procedure in this document - [Create an Event Hubs namespace and an event hub using the Azure portal](

## Getting Started

Install the package [twitter2eh]( using pip:
pip install twitter2eh
sudo pip install twitter2eh

## Usage
twitter2eh -h

usage: twitter2eh [-h] [-v] [--init] [-c CONF] [-s]

This program streams feed from Twitter to EventHub

optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
--init Create template client conf twitter2eh.json only if
there is no existing one
-c CONF, --conf CONF twitter2eh configuration file. Default:twitter2eh.json
-s, --silent silent mode - running the tool without displaying tweets json that you are streaming to your Event Hub
## Configuration file - twitter2eh.json
In order to run the tool, you need to configure a configuration file for the tool and specify the file in running the tool.
"twitter_consumer_key" : "<Consumer Key for Twitter App>",
"twitter_consumer_secret" : "<Consumer Secret for Twitter App>",
"twitter_access_token" : "<Access Token for Twitter App>",
"twitter_access_secret" : "<Access Secret for Twitter App>",
"track_keywords" : [
"<Keyword or Hashtag>",
"<Keyword or Hashtag>",
"<Keyword or Hashtag>"
"eventhub_namespace" : "<Event Hub Namespace>",
"eventhub_entity" : "<Event Hub Entity Name>",
"eventhub_sas_key" : "<Event Hub SAS Key Name>",
"eventhub_sas_value" : "<Event Hub SAS Value>"

Please refer to [example configuration file](twitter2eh.json.example) and run the tool like this:

% twitter2eh --conf ./twitter2eh.json

Or run with `-s|--silient` option if you want to run the tool without displaying tweets json that you're streaming to your Event Hub

% twitter2eh --conf ./twitter2eh.json --silent

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

twitter2eh-0.2.0.tar.gz (4.0 kB view hashes)

Uploaded source

Built Distribution

twitter2eh-0.2.0-py3-none-any.whl (4.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page