All Projects → twitivity → twitivity

twitivity / twitivity

Licence: MIT license
🐍 Twitter Accounts Activity API Client Library for Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to twitivity

gotwtr
gotwtr provides Twitter v2 API
Stars: ✭ 45 (-8.16%)
Mutual labels:  twitter-api, twitter-client
go-t
A blazing-fast, simple and easy to use command-line client for Twitter written in Go. 🚀📨
Stars: ✭ 70 (+42.86%)
Mutual labels:  twitter-api, twitter-client
twittered
Twitter API client for Java developers
Stars: ✭ 170 (+246.94%)
Mutual labels:  twitter-api, twitter-client
Surfbird
A Microblogging client built on Electron and Vue
Stars: ✭ 309 (+530.61%)
Mutual labels:  twitter-api, twitter-client
Awesome Twitter Tools
A curated list of awesome twitter tools
Stars: ✭ 113 (+130.61%)
Mutual labels:  twitter-api, twitter-client
Harpy
A Twitter app built with Flutter
Stars: ✭ 211 (+330.61%)
Mutual labels:  twitter-api, twitter-client
Birdy
A super awesome Twitter API client for Python.
Stars: ✭ 259 (+428.57%)
Mutual labels:  twitter-api, twitter-client
Twitterapi
Minimal python wrapper for Twitter's REST and Streaming APIs
Stars: ✭ 724 (+1377.55%)
Mutual labels:  twitter-api, twitter-client
Twitter.jl
Julia package to access Twitter API
Stars: ✭ 58 (+18.37%)
Mutual labels:  twitter-api, twitter-client
Twitter Api Php
The simplest PHP Wrapper for Twitter API v1.1 calls
Stars: ✭ 1,808 (+3589.8%)
Mutual labels:  twitter-api, twitter-client
discord-twitter-webhooks
🤖 Stream tweets to Discord
Stars: ✭ 47 (-4.08%)
Mutual labels:  webhooks, twitter-api
starter-NodeJS
Recast.AI official starter-kit for NodeJS
Stars: ✭ 22 (-55.1%)
Mutual labels:  ngrok
asyncio-socks-server
A SOCKS proxy server implemented with the powerful python cooperative concurrency framework asyncio.
Stars: ✭ 154 (+214.29%)
Mutual labels:  pypi
export-dynamodb
Export Amazon DynamoDb to CSV or JSON
Stars: ✭ 52 (+6.12%)
Mutual labels:  pypi
pandoc-latex-environment
Pandoc filter for adding LaTeX environement on specific div
Stars: ✭ 27 (-44.9%)
Mutual labels:  pypi
pypi-tools
Command-line Python scripts to do things with PyPI
Stars: ✭ 18 (-63.27%)
Mutual labels:  pypi
hej
Hej! is a simple authentication boilerplate for Socialite.
Stars: ✭ 111 (+126.53%)
Mutual labels:  register
twitter-crypto-bot
This is a Twitter bot that tweets about cryptocurrencies prices every certain amount of minutes
Stars: ✭ 21 (-57.14%)
Mutual labels:  twitter-api
odf-nano
ODF-Nano lets you deploy OpenShift Data Foundation on your Laptop (CRC)
Stars: ✭ 37 (-24.49%)
Mutual labels:  crc
Tweet-2-RSS
Convert your Twitter API requests to RSS Feeds
Stars: ✭ 14 (-71.43%)
Mutual labels:  twitter-api

Twitivity

Premium PyPI - Python Version Downloads PyPI - License

Twitter Accounts Activity API Client Library for Python.

Account Activity API allows you to subscribe to user activities. Unlike Twitter's REST API or the Streaming API, the Account Activity API delivers data through webhook connections. Which makes it faster and allows it to deliver Twitter data to you in real-time. You can subscribe to these user activities.

Getting Started

  • Apply for a Twitter Developer Account
  • Create an application, fill in the required fields, the callback URL is your domain name with an added endpoint, for example https://yourdomain.com/listener. Twitter will later use this URL to send you account activity data. Make sure to enable "Read, Write and Direct messages" permission.
  • Navigate to the Dev environment section and setup a dev environment for the Account Activity API. Name a dev environment label of your choosing and select your app.

The next step is to register your webhook URL. Twitter will send a GET request with Challenge-Response Check or CRC token to verify you are the owner of the app and the webhook URL. To validate, an encrypted response token based on your consumer key and the CRC token has to be sent back to Twitter. Upon successful validation, registration of the webhook URL and subscription. Twitter will send data to this endpoint (the webhook URL) as a POST request.

Why Twitivity?

Twitivity does all the heavy lifting under the hood. All you have to do is to create an app and set up a dev environment. Run the application and concentrate on what's really important — building your app.

  • Performs challenge-response check validation
  • Registers webhook URL.
  • Subscribes to current user's context
  • Receives Twitter Account Activity in real-time

Usage

Ngrok is a handy tool to try out the API locally, on your machine. Install and run ngrok and replace your app's URL and callback URL with the link ngrok provides. Make sure to use the one with https.

~$ ./ngrok http 5000

Stream events in real time.

# stream_events.py

>>> from twitivity import Event
>>> import json

>>> class StreamEvent(Event):
     CALLBACK_URL: str = "https://yourdomain.com/listener"

     def on_data(self, data: json) -> None:
         # process data

>>> stream_events = StreamEvent()
>>> stream_events.listen()

Configuration

The configuration below only has to be done once before running the application for the first time.

Store the credentials as environment variables.

App ➡️ Details ➡️ Keys and Tokens

~$ export consumer_key=API_KEY
~$ export consumer_secret=API_SECRET_KEY
~$ export access_token=ACCESS_TOKEN
~$ export access_token_secret=ACCESS_TOKEN_SECRET
~$ export env_name=ENV_NAME # this is the dev environment label name you choose.

Register & Subscribe

To register the webhook URL and subscribe to activities, run both programs in parallel (first stream_events.py then configure.py). This will register the webhook URL and subscribe to the user's activities.

# configure.py
>>> from twitivity import Activity

>>> account_activity = Activity()
>>> account_activity.register_webhook("https://youdomain.com/listener")
>>> account_activity.subscribe()

# Response
{
  'id': '1198870971131686912', # webhook id
  'url': 'https://yourdomain.com/listener',
  'valid': True,
  'created_timestamp': '2019-11-25 07:48:08 +0000'
}

Installation

~$ pip3 install twitivity

Deploying

Documentation on how to deploy it on web servers.

Supported Versions: Python 3.6, Python 3.7 and Python 3.8

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].