Package: gathercontent
This is a very simple API wrapper for GatherContent in Python. For more information about the GatherContent API, have a look at:http://help.gathercontent.com/developer-api/DependenciesYou’ll needrequests. If you’re installing via Pypi/pip, this should be installed automatically. If you need to install it manually, this was developed againstrequests==2.5.1, so it’s probably best to use that.UsageThis module exposes all documented GatherContent API methods. Assuming the URL schema doesn’t change, it should work with future API versions, too, as long as the URI’s are all prefixed withget_. Right now, I’ve tested this with the following API methods:get_me – logged in userget_users – all visible users for given API keyget_user (id) – user with specified idget_my_group – group that API user belongs toget_groups – all visible groups for given API keyget_group (id) – group with specified idget_projects – all visible projects for given API keyget_project (id) – project with specified idget_page (id) – page with specified idget_pages_by_project (id) – all pages belonging to project with specified idget_file (id) – file with specified idget_files_by_project (id) – all files belonging to project with specified idget_files_by_page (id) – all files belonging to page with specified idget_custom_state (id) – custom state with specified idget_custom_states_by_project (id)The API takes the JSON responses and converts them into Python dictionaries. For example:>>> from gathercontent import GatherContent
>>> gc = GatherContent(api_key="your-api-key-here", account_name="your-account-name-here")
>>> gc.get_users()
>>> users = gc.get_users()
>>> type(users)
<type 'dict'>
>>> users
{u'users': [{u'first_name': u'Example', u'last_name': u'User', u'created_at': u'2014-10-14 10:33:08', u'updated_at': u'2015-02-04 11:30:01', u'email': u'person@example.com', u'timezone': u'UTC', u'group_id': u'29122', u'id': u'75580'}], u'success': True}
>>> gc.get_user(id=75580)
{u'user': {u'first_name': u'Example', u'last_name': u'User', u'created_at': u'2014-10-14 10:33:08', u'updated_at': u'2015-02-04 11:30:01', u'email': u'person@example.com', u'timezone': u'UTC', u'group_id': u'29122', u'id': u'75580'}, u'success': True}LicenseThe MIT License (MIT)Copyright (c) 2015 FARM Digital Ltd.Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.CreditsThanks to everyone at [FARM Digital](http://www.wearefarm.com/) for the code review before we published this.