Skip to content

Configuration

These are the options that can be specified in your .ini config file. The only required options are the twitter credentials. Everything else has a sensible default set.

[REQUIRED]

Name Description Options
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

All of these can be obtained by creating a single-user app at apps.twitter.com. They can be found on the "keys and access tokens" tab when viewing your app.

Tweet Templates

Tweets are generated using Jinja2 and use tokens derived from the package dictionary. See Usage for more detail.

Name Description Default
ckanext.twitter.new Template for tweets about new datasets New dataset: "{{ title }}" by {{ author }} ({%- if records != 0 -%} {{ records }} records {%- else -%} {{ resources }} resource {%- endif -%}).
ckanext.twitter.updated Template for tweets about updated datasets Updated dataset: "{{ title }}" by {{ author }} ({%- if records != 0 -%} {{ records }} records {%- else -%} {{ resources }} resource {%- endif -%}).

If your config is created dynamically using Jinja2, you will have to wrap any custom template in {% raw %}{% endraw %} tags and add a newline after it, e.g.:

ckanext.twitter.new = {% raw %}{{ title }} by {{ author }} ({{ records }} records) has just been published!{% endraw %}

ckanext.twitter.consumer_key = {{ twitter.consumer_key }}
ckanext.twitter...

Other options

Name Description Options Default
ckanext.twitter.debug Is in debug mode; overrides global debug flag if specified True, False False
ckanext.twitter.hours_between_tweets Number of hours between tweets about the same dataset (to prevent spamming) 24
ckanext.twitter.disable_edit If true, users will not be able to edit the tweet about their dataset before it is posted (though they can still decide not to post it) True, False False