{ "info": { "author": "Open Knowledge Foundation", "author_email": "info@okfn.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Gobble\n\nGobble is the client API for [Open-Spending](next.openspending.org), an international platform to package, share and visualize budget data. Gobble does exactly the same thing as the [packager interface](next.openspending.org/packager), except programatically. It can be used both as python client or a command line interface. It's compatible with versions 2.7, 3.3, 3.4 and 3.5. You can install it via `pip`.\n\n```\npip install gobble\n```\n\n## Fiscal Data Packages\n\nA generic [Datapackage](http://frictionlessdata.io/data-packages/) is a lightweight container for data. A [Fiscal Data Package](http://fiscal.dataprotocols.org/) is a special type of data package for government budget and spending data. It's user-oriented and aims to be extremely easy to use, both for those publishing data (e.g. governments) and for those wanting to use the data (such as researchers and journalists). \n\nTechnically speaking, a fiscal datapackage consists of a `JSON` descriptor pointing to data files. The `JSON` descriptor needs to follow [fiscal data specifications](http://fiscal.dataprotocols.org/spec/). A basic local fiscal data package could look like this:\n\n```\n/basepath/budget.json \n /data/budget_2014.csv\n budget_2015.csv\n```\n\nOnce your fiscal data package is ready, you can start using Gooble.\n\n## Command line interface\n\nAsciinema to come... \n\n## Python client\n\n### Fiscal data package objects\n\nIn Gobble, fiscal data is represented by the `FiscalDataPackage` class. It's a sub-class of the `DataPackage` class, defined in the [datapackage-py](https://github.com/frictionlessdata/datapackage-py) library. To create a `FiscalDataPackage` object, pass the path of your descriptor to the constructor:\n\n```\nbudget = FiscalDataPackage('path/to/my/package/descriptor.json')\n```\n\nNote that as of today, Open-Spending only supports data files in `CSV` format, so `FiscalDataPackage` will raise a `NotImplemented` error if you try and pass it other formats.\n\n### Validation\n\nTo validate the fiscal datapackage descriptor schema:\n\n```\nbugdet.validate()\n```\n\nIf the descriptor schema is invalid, a `ValidationError` will be raised. To get a `list` of errors instead, set the `raise_error` flag to `False`.\n```\nbudget.validate(raise_error=False)\n```\n\n### Upload\n\nTo upload a fiscal data package to Open-Spending: \n\n```\nurl = budget.upload() # the url of your new package on Open-Spending\n```\n\nBy default, uploaded packages are private. You can toggle the publication state like so:\n\n```\nnew_state = budget.toggle('public') # returns 'public'\n```\n\n### Search\n\nYou can search (and download) the descriptor file of existing fiscal data packages from the Open-Spending platform like so:\n\n```\nquery = {'countryCode': 'MX'}\nresults = search(query)\n```\n\nwhere `results` is list of `JSON` package descriptors (as `dict`). Valid search keys are: `size`, `title`, `author`, `description`, `regionCode`, `countryCode`, `cityCode`. Or you can use the magic `q` key to search all fields at once.\n\nYou can limit search results and include you private packages in the results like so:\n\n```\nquery = {'author': 'mickey_mouse'}\nresults = search(query, limit=5, private=True)\n```\n\n## Resources\n\n- [Open-Spending web platform](next.openspending.org) \n- [Open-Spending docs for developers](http://docs.openspending.org/en/latest/)\n- [datapackage-py package repository](http://frictionlessdata.io/data-packages/) \n- [Fiscal Data Package homepage](http://fiscal.dataprotocols.org/)\n- [Open-Knowledge Foundation](https://okfn.org)\n\n## License\n\nGobble is under [MIT License](https://opensource.org/licenses/MIT).\n\n## Contributions\n\nWe welcome feedback, issues and pull-requests. Please check out the [contribution guidelines](https://github.com/okfn/coding-standards).", "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/openspending/gobble", "keywords": "open spending frictionless data fiscal datapackage", "license": "The MIT License (MIT)", "maintainer": null, "maintainer_email": null, "name": "Open-Spending-Gobble", "package_url": "https://pypi.org/project/Open-Spending-Gobble/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Open-Spending-Gobble/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/openspending/gobble" }, "release_url": "https://pypi.org/project/Open-Spending-Gobble/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Command line tools for the Open-Spending datastore.", "version": "0.1.0" }, "last_serial": 2273978, "releases": { "0.1.0": [] }, "urls": [] }