Twitter

https://img.shields.io/pypi/v/kpireport-twitter
pip install kpireport-twitter

API

class kpireport_twitter.TwitterDatasource(report, **kwargs)

Bases: kpireport.datasource.Datasource

A datasource that can fetch metrics from Twitter’s V2 API.

Currently the following queries are supported:

  • tweets: request a list of the user’s latest Tweets via the Timeline API. If requesting the authenticated user’s own timeline, “non-public” metrics such as impression counts are included in the output table result. Otherwise, only public metrics such as like, reply, and retweet counts are retrieved. The text and ID of the Tweet are also included in the output table.

consumer_key

The Twitter application consumer public key.

Type

str

consumer_secret

The Twitter application consumer secret.

Type

str

access_token_key

The user-scoped access token public key.

Type

str

access_token_secret

The user-scoped access token secret.

Type

str

pagination_delay_s

The number of seconds to wait before fetching the next page of results from Twitter’s API. It is recommended to set this to at least 1 to avoid rate limits or downstream errors from the API. (Default 5)

Type

int

query(query: str, **kwargs)pandas.core.frame.DataFrame

Query the datasource.

Parameters

input (str) – The query string.

Returns

The query result.

Return type

pandas.DataFrame

class kpireport_twitter.TwitterEngagement(report: Report, datasources: kpireport.datasource.DatasourceManager, **kwargs)

Bases: kpireport_plot.plot.Plot

Display a summary of engagement with an account’s own Tweets.

\*\*kwargs

keyword arguments passed to the parent Plot plugin.

Changelog

0.1.1

Bug Fixes

  • Tweets are now displayed in the timezone configured in the report.

  • Always use OAuth2 when authenticating, even when using consumer key/secret application-only authentication. OAuth1.0 will throw an error from the TwitterAPI module.

0.1.0

New Features

  • A new View twitter.engagement is available. The view will show a scatter plot of recent tweets, displaying their like/reply/retweet counts. The highest- liked tweet is called out visually as well.

0.0.1

Prelude

Initial commit.

New Features

  • A new twitter Datasource is available from this plugin, which allows you to query for Tweets of a given user.