{ "info": { "author": "Alex Parinov", "author_email": "creafz@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "==============\npython-addthis\n==============\n.. image:: https://pypip.in/version/addthis/badge.svg\n :target: https://pypi.python.org/pypi/addthis/\n :alt: Latest Version\n\n.. image:: https://travis-ci.org/creafz/python-addthis.svg?branch=master\n :target: https://travis-ci.org/creafz/python-addthis\n\n.. image:: https://coveralls.io/repos/creafz/python-addthis/badge.png?branch=master\n :target: https://coveralls.io/r/creafz/python-addthis?branch=master\n\nA Python wrapper for the `AddThis Analytics API `_.\n\nRequirements\n------------\n* Python 2.6, 2.7 or 3.2+\n* `python-requests `_ library\n\nInstallation\n------------\nInstall from PyPI::\n\n pip install addthis\n\nUsage\n-----\n\n::\n\n from addthis import Addthis\n\n # create an AddThis instance using userid and password from your AddThis account and optionally provide a pubid\n addthis = Addthis(userid=\"YOUR_USER_ID\", password=\"YOUR_PASSWORD\", pubid=\"YOUR_PUB_ID\")\n\n # get the number of shares for the last day\n print addthis.shares.day()\n\n # get the number of shares by day for the last week\n print addthis.shares.day(period=\"week\")\n\n\nYou can see a full description of all supported metrics and dimensions at http://support.addthis.com/customer/portal/articles/381264-addthis-analytics-api\n\nA few more examples\n~~~~~~~~~~~~~~~~~~~\n\n**How many times was my content shared on Twitter, by day, over the last week?**\n::\n\n >>> addthis.shares.day(period=\"week\", service=\"twitter\")\n\n**What were my top shared urls for the pubid=\"MY_PUB_ID\"?**\n::\n\n >>> addthis.shares.url(pubid=\"MY_PUB_ID\")\n\n**How many users shared my content this month, broken down by their interests?**\n::\n\n >>> addthis.sharers.interest(period=\"month\")\n\n**Which sharing services sent the most clicks back to my site this week?**\n::\n\n >>> addthis.clicks.service(period=\"week\")\n\nExceptions\n----------\n\nAddthisValidationError\n~~~~~~~~~~~~~~~~~~~~~~\nAddthis object expects to be called with 2 parameters - \"metric\" and \"dimension\"::\n\n addthis..()\n\n\nFor example::\n\n >>> addthis.shares.day() # \"shares\" is a metric and \"day\" is a dimension\n\n\nIf it gets another number of parameters (e.g. addthis.shares() or addthis.shares.day.week()) it will raise an **AddthisValidationError**.\n\n::\n\n from addthis import Addthis, AddthisValidationError\n\n addthis = Addthis(userid=\"YOUR_USER_ID\", password=\"YOUR_PASSWORD\", pubid=\"YOUR_PUB_ID\")\n\n try:\n addthis.shares()\n except AddthisValidationError as e:\n print e # \"Incorrect number of parameters are given. Expected 2 but got 1.\"\n\n\n\n\nAddthisError\n~~~~~~~~~~~~\n**AddthisError** is raised when AddThis service returns a response with a HTTP status code other than 200. The exception object has 4 attributes:\n\n* *status_code*: Code from the HTTP response.\n* *code*, *message*, *attachment*: Error attributes from the AddThis response body. (see the \u201cError\" section in the `AddThis Analytics API documentation `_ for more information).\n\n::\n\n from addthis import Addthis, AddthisError\n\n addthis = Addthis(userid=\"INCORRECT_USER_ID\", password=\"INCORRECT_PASSWORD\", pubid=\"INCORRECT_PUB_ID\")\n\n try:\n addthis.shares.day()\n except AddthisError as e:\n print e # \"401 Error (code = '80', message='authentication failed', attachment='{u'nonce': None, u'realm': u'AddThis', u'opaque': None})'.\"\n print e.status_code # 401\n print e.code # 80\n print e.message # \"authentication failed\"\n print e.attachment # {u'nonce': None, u'realm': u'AddThis', u'opaque': None}", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/creafz/python-addthis/tarball/0.1.2", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/creafz/python-addthis", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "addthis", "package_url": "https://pypi.org/project/addthis/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/addthis/", "project_urls": { "Download": "https://github.com/creafz/python-addthis/tarball/0.1.2", "Homepage": "https://github.com/creafz/python-addthis" }, "release_url": "https://pypi.org/project/addthis/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "A Python wrapper for the AddThis Analytics API", "version": "0.1.2" }, "last_serial": 1324671, "releases": { "0.1.0": [], "0.1.1": [ { "comment_text": "", "digests": { "md5": "193b0deb8125264c1deaaeba0b7d3cbf", "sha256": "a122a80f70211c6bbfb6fff8931a44496f27ee22a4d5c5466d9722cda1974943" }, "downloads": -1, "filename": "addthis-0.1.1.tar.gz", "has_sig": false, "md5_digest": "193b0deb8125264c1deaaeba0b7d3cbf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6119, "upload_time": "2014-11-28T10:44:01", "url": "https://files.pythonhosted.org/packages/ea/67/a44c64b9499f71defbcb7f7c88593f7657b49be06982b4331bcc4c7e533c/addthis-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "43c1450eeea1c4e3a510c82b60d7a036", "sha256": "1098f5649845fadaf245243f30e8d2f802dbfd897d5452dc1455de5e5d09bf45" }, "downloads": -1, "filename": "addthis-0.1.2.tar.gz", "has_sig": false, "md5_digest": "43c1450eeea1c4e3a510c82b60d7a036", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6360, "upload_time": "2014-11-29T08:21:36", "url": "https://files.pythonhosted.org/packages/8d/a3/a624317e26c7bf2643ca18c5d10761d6be30eb83a851adfcb0a12dd617d6/addthis-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "43c1450eeea1c4e3a510c82b60d7a036", "sha256": "1098f5649845fadaf245243f30e8d2f802dbfd897d5452dc1455de5e5d09bf45" }, "downloads": -1, "filename": "addthis-0.1.2.tar.gz", "has_sig": false, "md5_digest": "43c1450eeea1c4e3a510c82b60d7a036", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6360, "upload_time": "2014-11-29T08:21:36", "url": "https://files.pythonhosted.org/packages/8d/a3/a624317e26c7bf2643ca18c5d10761d6be30eb83a851adfcb0a12dd617d6/addthis-0.1.2.tar.gz" } ] }