
Welcome to Klout API's documentation!
*************************************

[image]

* Design Philosophy
  * Klout API URL Structure
  * Designing python functions
  * Klout API URL to Python Function mapping examples
A minimalist klout API interface. Use of this API  requires klout
*developer key*. You can get registered and get a key at

   <http://klout.com/s/developers/v2>

Supports Python >= 2.5 and Python 3


Quickstart
==========

Install the PyPi package:

   pip install Klout

This short example shows how to get a kloutId first and fetch user's
score using that kloutId:

   from klout import *

   # Make the Klout object
   k = Klout('YOUR_KEY_HERE')

   # Get kloutId of the user by inputting a twitter screenName
   kloutId = k.identity.klout(screenName="erfaan").get('id')

   # Get klout score of the user
   score = k.user.score(kloutId=kloutId).get('score')

   print "User's klout score is: %s" % (score) 

   # Optionally a timeout parameter (seconds) can also be sent with all calls
   score = k.user.score(kloutId=kloutId, timeout=5).get('score')


Design Philosoph
================

See *Design Philosophy*


API Documentation
=================

class class klout.api.Klout(key, domain='api.klout.com', secure=False, api_version=<class 'klout.api._DEFAULT'>)

   A minimalist yet fully featured klout API interface.

   Get RESTful data by accessing members of this class. The result is
   decoded python objects (dicts and lists).

   The klout API is documented at:

      http://klout.com/s/developers/v2

   Examples:

   We need a *developer key* to call any Klout API function

   >>> f = open('key')
   >>> key= f.readline().strip()
   >>> f.close()

   By default all communication with Klout API is not secure (HTTP).
   It can be made secure (HTTPS) by passing an optional *secure=True*
   to *Klout* constructor like this:

   >>> k = Klout(key, secure=True)

   **Identity Resource**

   All calls to the Klout API now require a unique kloutId.  To
   facilitate this, you must first translate a {network}/{networkId}
   into a kloutId.

   * Get kloutId by twitter id

   >>> k.identity.klout(tw="11158872")
   {u'id': u'11747', u'network': u'ks'}

   * Get kloutId by twitter screenName

   >>> k.identity.klout(screenName="erfaan")
   {u'id': u'11747', u'network': u'ks'}

   * Get kloutId by google plus id

   >>> k.identity.klout(gp="112975106809988327760")
   {u'id': u'11747', u'network': u'ks'}

   **User Resource**

   Once we have kloutId, we can use this resource to lookup user's
   score, influcent or topics

   * Get user score

   >>> k.user.score(kloutId='11747') # doctest: +ELLIPSIS
   ...                               # doctest: +NORMALIZE_WHITESPACE
   {u'score': ..., u'scoreDelta': {u'dayChange': ..., u'monthChange': ...}} 

   * Get user influences

   >>> k.user.influence(kloutId='11747') # doctest: +ELLIPSIS
   ...                                   # doctest: +NORMALIZE_WHITESPACE
   {u'myInfluencersCount': ..., u'myInfluenceesCount': ...,     u'myInfluencers': [...], u'myInfluencees': [...]}

   * Get user topics

   >>> k.user.topics(kloutId='11747') # doctest: +ELLIPSIS
   ...                                # doctest: +NORMALIZE_WHITESPACE
   [{u'displayName': ..., u'name': ..., u'imageUrl': ..., u'id': ..., u'topicType': {...}, u'slug': ...}, ...]

exception exception klout.api.KloutError(e)

   Base Exception thrown by Klout object when there is a general error
   interacting with the API.

exception exception klout.api.KloutHTTPError(e, uri)

   Exception thrown by Klout object when there is an HTTP error
   interacting with api.klout.com.
