ckanext-twitter
DEPRECATED. Due to the API changes Twitter/X introduced in 2023, this extension no longer works and will not be fixed. There will not be any further releases, new features, or bugfixes.
Status: ARCHIVED (May 14, 2024)
A CKAN extension that enables users to post a tweet every time a dataset is created or updated. Developed by the Natural History Museum, London.
Features
- Automatic tweet posting when datasets are created or updated
- Uses the
after_update hook to trigger tweets
- Jinja2 template-based tweet generation with tokens from package dictionary
- Configurable tweet templates for new and updated datasets
- Debug mode for testing without posting
- Cooldown period between tweets (configurable)
- Option to disable edit notifications
Requirements
- CKAN 2.9
- Python 3.6, 3.7, 3.8
- oauth2==1.9.0.post1
- ckantools>=0.3.0
Installation
Install the extension:
pip install ckanext-twitter
Add twitter to your CKAN plugins:
ckan.plugins = twitter
Configuration
# REQUIRED - Twitter API credentials
ckanext.twitter.consumer_key = <your Twitter consumer key>
ckanext.twitter.consumer_secret = <your Twitter consumer secret>
ckanext.twitter.token_key = <your Twitter token key>
ckanext.twitter.token_secret = <your Twitter token secret>
# Tweet templates (Jinja2)
ckanext.twitter.new = <template for new datasets>
ckanext.twitter.updated = <template for updated datasets>
# Other options
ckanext.twitter.debug = True/False (default: False)
ckanext.twitter.hours_between_tweets = <integer> (default: 24)
ckanext.twitter.disable_edit = True/False (default: False)
License
GPL-3.0