# TwitterEventHubFeed
A command line tool that allow to stream feed from Twitter to EventHub.
This project is a fork of the [TwitterCosmosDBFeed](https://github.com/tknandu/TwitterCosmosDBFeed) by [tknandu](https://github.com/tknandu)
## Pre-requisites
- (1) Registration as a Twitter App
- You need to register the tool as a new application at <http://apps.twitter.com/>. 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](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-create)
## Getting Started
Install the package [twitter2eh](https://test.pypi.org/project/twitter2eh/) using pip:
```
pip install twitter2eh
or
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
```
A command line tool that allow to stream feed from Twitter to EventHub.
This project is a fork of the [TwitterCosmosDBFeed](https://github.com/tknandu/TwitterCosmosDBFeed) by [tknandu](https://github.com/tknandu)
## Pre-requisites
- (1) Registration as a Twitter App
- You need to register the tool as a new application at <http://apps.twitter.com/>. 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](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-create)
## Getting Started
Install the package [twitter2eh](https://test.pypi.org/project/twitter2eh/) using pip:
```
pip install twitter2eh
or
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
```
Release files for twitter2eh 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| twitter2eh-0.2.0.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| twitter2eh-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / twitter2eh-0.2.0.tar.gz
| Download URL | twitter2eh-0.2.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8b835a59160d86de1a037ce78dadce7750d5fe8c9690c931799c3869c081132
|
|
BLAKE2b-256 checksum How to use checksums |
587b9df89e6693d2b5162d77bbaffc81beb1e5388e7adb010e9dc4958c2f5e35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / twitter2eh-0.2.0-py3-none-any.whl
| Download URL | twitter2eh-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
902f6d9cfb44c3340d05ede2a17abc494b8f1e2001803b932e2d03ffa43e065a
|
|
BLAKE2b-256 checksum How to use checksums |
d7b025850c51dd5263ddd5d18a86cdf98e612392bf02f8942c2fffa4e710c119
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |