Skip to content

bigspaceship/botornot-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BotOrNot Python API

A Python API for Truthy BotOrNot.

Behind the scenes, this uses the BotOrNot's HTTP endpoint as illustrated in this notebook.

Help

You probably want to have a look at Troubleshooting & FAQ in the wiki. Please feel free to suggest and/or contribute improvements to that page.

Quickstart

From your command shell, run

pip install botornot

then in a Python shell or script, enter something like this:

import botornot

twitter_app_auth = {
    'consumer_key': 'xxxxxxxx',
    'consumer_secret': 'xxxxxxxxxx',
    'access_token': 'xxxxxxxxx',
    'access_token_secret': 'xxxxxxxxxxx',
  }
bon = botornot.BotOrNot(**twitter_app_auth)

# Check a single account
result = bon.check_account('@clayadavis')

# Check a sequence of accounts
accounts = ['@clayadavis', '@onurvarol', '@jabawack']
results = list(bon.check_accounts_in(accounts))

Result:

{
  "score": 0.37,
  "meta": {"screen_name": "clayadavis", "user_id": "1548959833"},
  "categories": {
    "content_classification": 0.27,
    "friend_classification": 0.15,
    "network_classification": 0.17,
    "sentiment_classification": 0.25,
    "temporal_classification": 0.43,
    "user_classification": 0.36
  }
}

Install instructions

  1. Clone this repository and navigate to it with your terminal of choice.
  2. python setup.py install

Dependencies

Python dependencies

Both of these dependencies are available via pip, so you can install both at once with

pip install requests tweepy

Twitter app

In order to access Twitter's API, one needs to have/create a Twitter app. Once you've created an app, the authentication info can be found in the "Keys and Access Tokens" tab of the app's properties: Screenshot of app "Keys and Access Tokens"

About

A Python API for Truthy BotOrNot

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%