Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
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.
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.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.
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.
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.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()
The configuration below only has to be done once before running the application for the first time.
App
:arrow_right: Details
:arrow_right: 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.
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'
}
~$ pip3 install twitivity
Documentation on how to deploy it on web servers.
Supported Versions: Python 3.6, Python 3.7 and Python 3.8
FAQs
Twitter Accounts Activity API Client Library for Python
We found that twitivity demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.