Skip to main content

Python client for the Diffbot API.

Project description

Bitdeli Build Status Coverage Status

How to use it:

>>> import diffbot
>>> json_result = diffbot.article('', token='…')

The above simple example is a shortcut for using the diffbot.Client class.

>>> import diffbot
>>> client = diffbot.Client(token='…')
>>> json_result = client.article('')

The above calls are shortcuts for using the diffbot.api() function and the diffbot.Client.api method:

>>> import diffbot
>>> client = diffbot.Client(token='…')
>>> json_result = client.api('article', '')

To POST data (text or HTML) to the API, use the text or html arguments:

>>> import diffbot
>>> client = diffbot.Client(token='…')
>>> json_result = client.api('article', '', html='''
... <h1>Introducing GitHub Traffic Analytics</h1>
... <p>We want to kick off 2014 with a bang, so today we're happy to launch
... traffic analytics!</p>
... ''')

Command line interface:

$ python -h
usage: [-h] [-a] [-f FILE] api url token

positional arguments:
  api                   API to call. One one of 'article', 'frontpage',
                        'product', 'image', 'analyze' or 'discussion'.
  url                   URL to pass as the 'url' parameter.
  token                 API key (token). Get one at

optional arguments:
  -h, --help            show this help message and exit
  -a, --all             Request all fields.
  -f FILE, --file FILE  File to read data from. Use '-' to read from STDIN.

$ python article TOKEN

Output of the above example:

  "icon": "",
  "sections": [
  "title": "Build software better, together.",
  "url": ""


  • Python 2+3 support

  • Google App Engine support

  • Requests support (but no dependency)

  • Passes pyflakes, pep8, flake8, pylint score 10/10

  • Simple & small (1 file, <200 LOC)

  • Command line interface

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diffbot-2.0.0.tar.gz (5.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page