{
"info": {
"author": "Openpolis",
"author_email": "guglielmo@openpolis.it",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 2 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Utilities"
],
"description": "::\n\n _____ _\n | __ \\ | |\n | |__) |___ _ __ | | _ _ ___\n | ___// _ \\ | '_ \\ | || | | |/ __|\n | | | (_) || |_) || || |_| |\\__ \\\n |_| \\___/ | .__/ |_| \\__,_||___/\n _____ | | _\n / ____| |_| | |\n | | ___ _ __ ___ _ __ ___ _ __ ___ _ __ | |_\n | | / _ \\ | '_ ` _ \\ | '_ \\ / _ \\ | '_ \\ / _ \\| '_ \\ | __|\n | |____| (_) || | | | | || |_) || (_) || | | || __/| | | || |_\n \\_____|\\___/ |_| |_| |_|| .__/ \\___/ |_| |_| \\___||_| |_| \\__|\n _____ _ | | _ _\n |_ _| | | |_| | | (_)\n | | _ __ | |_ ___ __ _ _ __ __ _ | |_ _ ___ _ __\n | | | '_ \\ | __|/ _ \\ / _` || '__|/ _` || __|| | / _ \\ | '_ \\\n _| |_ | | | || |_| __/| (_| || | | (_| || |_ | || (_) || | | |\n |_____||_| |_| \\__|\\___| \\__, ||_| \\__,_| \\__||_| \\___/ |_| |_|\n __/ |\n |___/\n\nGeneric Python bindings to connect to the `Poplus components `_ APIs.\n\n----\n\n|pypi| |unix_build| |downloads| |license|\n\n----\n\n\nActually, this is only a convenient wrapper around `Tortilla `_ generic\nAPI wrapper, with some specialized instructions to use Poplus components apis.\n\nThe main advantage of Tortilla over other wrappers is that it allows access through a\nfull object oriented interface, both when requesting data, and when parsing the results.\n\nResults are transformed from JSON into a Python dictionary, and then bunchified.\n\nInstallation\n------------\npoplus-pci is available as a module on PyPi, to install, simply run::\n\n pip install poplus-pci\n\nAlternatively, you can clone this repo and install as you see fit.\n\n\nQuick start\n-----------\n\nFirst, let's try read-only access to the ``legisladores-ar`` instance of Popit at mySociety,\nand get the paged list of political organizations in the argentinian parliament:\n\n.. code-block:: python\n\n from pci import Popit\n\n popit = Popit(\n instance='legisladores-ar',\n host='popit.mysociety.org',\n )\n\n``instance``\n Name of the instance you want to point to.\n There can be more than one for one installation.\n\n``host``\n The hostname of the PopIt server.\n\nOnce an instancehas been created, it's easy enough to access data,\nusing a full object oriented interface:\n\n.. code-block:: python\n\n os = popit.organizations.get()\n\n # there are 65 organizations\n print(os.total)\n\n\n # but only 30 have been grabbed\n print(o.page)\n for i, o in enumerate(os.result, start=1):\n print(\"{0}: {1}\".format(i, o.name))\n\n # how to get next page?\n print os.next_url\n\n #\u00a0get it\n os = popit.organizations.get(params={'page': 2})\n\n\nWrite access (Popit)\n--------------------\n\nMake sure you have all the information you need. Then get the object use the `PopIt` constructor.\n\n.. code-block:: python\n\n from pci import Popit\n\n popit = Popit(\n instance='openpolistest',\n host='popit.mysociety.org',\n api_key='-YOUR-API-KEY-',\n )\n\n``api_key`` \n This is the API key you can request by clicking\n 'Get API key' in the PopIt web interface for your instance, as\n `described in the documentation `_.\n\nThen the basic CRUD operations will be:\n\n.. code-block:: python\n\n\n # create\n einstein = popit.persons.post(data={\n 'name': 'Albert Einstein',\n 'links': [{\n 'url': 'http://www.wikipedia.com/AlbertEinstein',\n 'note': 'Wikipedia'\n }]\n })\n\n #\u00a0read\n popit.persons(einstein.result.id).get()\n\n # update (note: is PUT, not PATCH)\n popit.persons(einstein.result.id).put(data={\"name\": \"Albert Einstein\"})\n\n # delete\n popit.persons(einstein.result.id).delete()\n\n\nIf you're still using an older PopIt instance and have not upgraded\nyour account for the new, more secure authentication system, instead\nof ``api_key`` you can supply ``user`` and ``password``:\n\n.. code-block:: python\n\n popit = Popit(\n instance='openpolistest',\n host='popit.mysociety.org',\n user='-USERNAME-',\n password='-PASSWORD-'\n )\n\n\n``user``\n Your username, the email address that you created the instance with\n\n``password``\n The password you were emailed when creating the instance\n\n\n\nPopit Search api\n----------------\n\nAlmost all APIs can be wrapped around the pci component, easily.\n\nStarting from a popit instance, queries through the search API can be done:\n\n.. code-block:: python\n\n popit.search.organizations.get(params={'q': 'trabajo'})\n popit.search.organizations.get(params={'q': 'trabajadores'})\n\n\nMapit access\n------------\n\nMapit has read-only access, and the API does not adhere to REST standards.\n\nThe default Mapit instance is MySociety's Global Mapit:\nhttp://global.mapit.mysociety.org/.\n\nThe mapit API call ``/point/SRID/LON,LAT/[box]``, can be invoked directly,\nby tortilla wrapping utilities, or by using Mapit helpers.\n\n.. code-block:: python\n\n mapit = Mapit()\n self.m.point.get('4326/12.5042,41.8981')\n self.m.areas_overpoint(lat='41.8981', lon='12.5042', srid='4326', box=True)\n\nOther helpers are available, and will be implemented as needed in the futures.\nYou can find them in the ``pci/__init__.py`` file.\n\nCaching\n-------\n\nTo limit the amount of requests to an API endpoint, a caching mechanism is available.\nYou can activate this with the ``cache_lifetime`` parameter, when creating a pci instance:\n\n.. code-block:: python\n\n mapit = Mapit(\n cache_lifetime=60,\n )\n\nSingle requests, though, can be performed ignoring the cache alltogether:\n\n.. code-block:: python\n\n mapit.point.get('4326/12.5042,41.8981', ignore_cache=True)\n\n\nRequirements\n------------\n\nIf you don't use pip to install the module, you'll also need:\n\n* tortilla (``pip install tortilla``)\n\n\nHow to run the tests\n--------------------\n\n* Copy the file ``config_sample.py`` to ``config_test.py``\n* Change the entries in ``config_test.py`` to refer to your test servers\n* Install `oktest `_ (``pip install oktest``)\n* Make sure components instances are running, and you have access to them.\n You cannot test this wrapper without running instances.\n* run ``python test.py`` to run all tests,\n ``python test_mapit.py``, or ``python test_popit.py`` to run the specified\n component's tests\n\n\nChangelog\n---------\n\n::\n\n === 0.1 (2015-02-20) ===\n initial release\n\n\nCredits\n-------\n\n- `tortilla`_\n- `popit-python`_\n- `slumber`_\n\n\n\n\n.. _tortilla: https://github.com/redodo/tortilla\n.. _popit-python: https://github.com/mysociety/popit-python\n.. _slumber: https://github.com/samgiles/slumber\n\n\n.. |pypi| image:: https://img.shields.io/pypi/v/poplus-pci.svg?style=flat-square&label=version\n :target: https://pypi.python.org/pypi/poplus-pci\n :alt: Latest version released on PyPi\n\n.. |coverage| image:: https://img.shields.io/coveralls/openpolis/poplus-pci/master.svg?style=flat-square\n :target: https://coveralls.io/r/openpolis/poplus-pci?branch=master\n :alt: Test coverage\n\n.. |unix_build| image:: https://img.shields.io/travis/openpolis/poplus-pci/master.svg?style=flat-square&label=unix%20build\n :target: http://travis-ci.org/openpolis/poplus-pci\n :alt: Build status of the master branch on Mac/Linux\n\n.. |downloads| image:: https://img.shields.io/pypi/dm/poplus-pci.svg?style=flat-square\n :target: https://pypi.python.org/pypi/poplus-pci\n :alt: Monthly downloads\n\n.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square\n :target: https://raw.githubusercontent.com/openpolis/poplus-pci/master/LICENSE\n :alt: Package license",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/openpolis/poplus-pci",
"keywords": "poplus api wrapper",
"license": "MIT",
"maintainer": null,
"maintainer_email": null,
"name": "poplus-pci",
"package_url": "https://pypi.org/project/poplus-pci/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/poplus-pci/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/openpolis/poplus-pci"
},
"release_url": "https://pypi.org/project/poplus-pci/0.1.12/",
"requires_dist": null,
"requires_python": null,
"summary": "Generic python bindings to connect to the Poplus components",
"version": "0.1.12"
},
"last_serial": 1482275,
"releases": {
"0.1.1": [],
"0.1.10": [
{
"comment_text": "",
"digests": {
"md5": "643d44171c312963e4eb6e649d5dd44e",
"sha256": "264dff48d9f970854f2474cf7035541afeab259fe51c1c5c37a43c6cd02724b4"
},
"downloads": -1,
"filename": "poplus-pci-0.1.10.tar.gz",
"has_sig": false,
"md5_digest": "643d44171c312963e4eb6e649d5dd44e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6455,
"upload_time": "2015-03-14T18:26:32",
"url": "https://files.pythonhosted.org/packages/20/c9/a29e30cf5dc59f77c3d892c9e6648e30987e088477fa3d2c62ebeb1aa9c1/poplus-pci-0.1.10.tar.gz"
}
],
"0.1.11": [
{
"comment_text": "",
"digests": {
"md5": "2f22d3201ccab42101978b9e924b0468",
"sha256": "99a5fd429cf114140f7b8799e60b872d98d05b048516cb1fed127f9e3cf4db04"
},
"downloads": -1,
"filename": "poplus-pci-0.1.11.tar.gz",
"has_sig": false,
"md5_digest": "2f22d3201ccab42101978b9e924b0468",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6453,
"upload_time": "2015-03-24T19:37:10",
"url": "https://files.pythonhosted.org/packages/c1/fe/a5743279a822dcbdf436faf4a4b59b2977bd4713e03a44f92b2048af4bec/poplus-pci-0.1.11.tar.gz"
}
],
"0.1.12": [
{
"comment_text": "",
"digests": {
"md5": "ac1130ad3993d8d6cce943af5f5362d6",
"sha256": "f39b1462535f17b9affac226a48dcaf092b8daa16a1152a682d65979399323a8"
},
"downloads": -1,
"filename": "poplus-pci-0.1.12.tar.gz",
"has_sig": false,
"md5_digest": "ac1130ad3993d8d6cce943af5f5362d6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6451,
"upload_time": "2015-03-29T15:01:59",
"url": "https://files.pythonhosted.org/packages/d4/27/3afcab9b3dc2b148f4abe614da84deb095979155b2d232f115d83d5ac12c/poplus-pci-0.1.12.tar.gz"
}
],
"0.1.2": [
{
"comment_text": "",
"digests": {
"md5": "88f0f182e66ab252362dddde275b56a5",
"sha256": "593b83c1003b59b593fcff3f234222b2faed9b0a1363bbb82741889d2b4b3377"
},
"downloads": -1,
"filename": "poplus-pci-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "88f0f182e66ab252362dddde275b56a5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7452,
"upload_time": "2015-02-19T22:31:31",
"url": "https://files.pythonhosted.org/packages/bb/78/ba12973545e8f127ff9e81ac588405696aa7e858e54d8d5a6eec3ecaf9e6/poplus-pci-0.1.2.tar.gz"
}
],
"0.1.3": [
{
"comment_text": "",
"digests": {
"md5": "d78e5e2c35b8d6fa964719e9c67c7340",
"sha256": "69905f1c182b2b38d5a56c2bc96f913c2d357c82ae49ae5b003851ef7e8c4aae"
},
"downloads": -1,
"filename": "poplus-pci-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "d78e5e2c35b8d6fa964719e9c67c7340",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8026,
"upload_time": "2015-02-19T23:17:05",
"url": "https://files.pythonhosted.org/packages/ae/bd/f0631a4ffee70dd4ea46133a0b989cd6083c6949a8cd1e09805a9fc3467b/poplus-pci-0.1.3.tar.gz"
}
],
"0.1.4": [
{
"comment_text": "",
"digests": {
"md5": "f6ad99f9f9a39aa8e31cf80183b96676",
"sha256": "ad467b3963a2c054ee39962ffb76fdd1fef4c6673d6baa00b2590a1215dc7dff"
},
"downloads": -1,
"filename": "poplus-pci-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "f6ad99f9f9a39aa8e31cf80183b96676",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12179,
"upload_time": "2015-02-20T10:55:31",
"url": "https://files.pythonhosted.org/packages/b7/24/2c974c743e78071ee788930574c1a70d7584d4315077177bff57077a457c/poplus-pci-0.1.4.tar.gz"
}
],
"0.1.5": [],
"0.1.6": [
{
"comment_text": "",
"digests": {
"md5": "c36f445e0a0f3850dbb10889f3586891",
"sha256": "6b9e438446230b0c8b4c0e5d8c47635e23592c8f9b288f7e64923cedf3f6e20d"
},
"downloads": -1,
"filename": "poplus-pci-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "c36f445e0a0f3850dbb10889f3586891",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14083,
"upload_time": "2015-02-20T15:36:56",
"url": "https://files.pythonhosted.org/packages/bb/a0/31d3bbf519834e0bb6df1ea23f4c34f516c3c8aa19118c589986f0d0677e/poplus-pci-0.1.6.tar.gz"
}
],
"0.1.8": [],
"0.1.8a0": [
{
"comment_text": "",
"digests": {
"md5": "0f761d09db42e18c7f62035b85cea2c0",
"sha256": "0d10ef166e96cc2e107ae455086a45b1f648cebda5e1f588a927c21a6e987296"
},
"downloads": -1,
"filename": "poplus-pci-0.1.8a0.tar.gz",
"has_sig": false,
"md5_digest": "0f761d09db42e18c7f62035b85cea2c0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6460,
"upload_time": "2015-03-14T18:13:46",
"url": "https://files.pythonhosted.org/packages/1d/cc/fb885b1de6567c6b25ab0f1b0b084d0b4b5c0a20088acf8427b7986ee294/poplus-pci-0.1.8a0.tar.gz"
}
],
"0.1.9": [
{
"comment_text": "",
"digests": {
"md5": "9e765aafe5775c349e9c6c48e131088b",
"sha256": "9083be62937ea72bee6805bfc382f5586202fbcdf116c33b0a55b67e2e16ac64"
},
"downloads": -1,
"filename": "poplus-pci-0.1.9.tar.gz",
"has_sig": false,
"md5_digest": "9e765aafe5775c349e9c6c48e131088b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6464,
"upload_time": "2015-03-14T18:21:05",
"url": "https://files.pythonhosted.org/packages/4d/21/1f76f612fe706b4d3e9d556841c974bf67c447a0a8f278d53996dee456ce/poplus-pci-0.1.9.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "ac1130ad3993d8d6cce943af5f5362d6",
"sha256": "f39b1462535f17b9affac226a48dcaf092b8daa16a1152a682d65979399323a8"
},
"downloads": -1,
"filename": "poplus-pci-0.1.12.tar.gz",
"has_sig": false,
"md5_digest": "ac1130ad3993d8d6cce943af5f5362d6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6451,
"upload_time": "2015-03-29T15:01:59",
"url": "https://files.pythonhosted.org/packages/d4/27/3afcab9b3dc2b148f4abe614da84deb095979155b2d232f115d83d5ac12c/poplus-pci-0.1.12.tar.gz"
}
]
}