Package: plastclient
Plastclient is an API wrapper forPlast.AuthenticationOAuthAll updates to Plast require OAuth 2 authentication. Plast is in active development, and key/secret pairs are granted individually.
Please contactnjb@smartm.noif you are interested in using Plast.AccessKeysApplications using Plast may request additional accesskeys using the AccessKey API. These keys are used to set and assert ownership
to objects created in Plast, and may be devided to individual users, groups of users or however the application sees fit.Installation$ pip install plastclientUsagefrom plastclient import PlastClientpc = PlastClient(’http://plast.host.com’, <oauth_key>, <oauth_secret>)states = pc.State.search(‘relativity’)General principlesAll communication is REST.All states & statesets have a public view.All data returned as dictionaries.OAuth key/secret & plast_accesskey is required for all updates.QueryQuery API.metaGets metadata for a list of uuids. All types are supported.pc.Query.meta([uuid1,uuid2])AccessKeyUse to interact with accesskeys.allGet a list of all accesskeys belonging to your application.pc.AccessKey.all()addCreate a new accesskey for you application.pc.AccessKey.add()updateUpdate an accesskey’s linked sets.pc.AccessKey.update(<accesskey>, statesets=[<set_uuid1>,<set_uuid2>], add=[<set_uuid3>], remove=[<set_uuid0>])Ifstatesetsis providedaddandremoveare ignored.statesets - replaces existing sets with provided setsadd - appends listed setsremove - removes listed setsStateUse to interact with states in Plast.getpc.State.get(<state_uuid>)get_listpc.State.get_list([<state_uuid1>,<state_uuid2>])addpc.State.add(‘state name’, <accesskey>)updatepc.State.update(<state_uuid>, <accesskey>, name=’updated name’, desription=’updated description’)searchpc.State.search(‘searchtext’)StateSetUse to interact with statesets.getpc.StateSet.get(<set_uuid>)addpc.StateSet.add(‘name of set’, <accesskey>)updatepc.StateSet.update(<set_uuid>, <accesskey>, name=’updated name’, description=’updated description’, states=[<state_uuid1>,<state_uuid2>], disabled=False)statesGet a fully detailed list of all states linked to this set.pc.StateSet.states(<set_uuid>)PlaceUse to interact with places.getpc.Place.get(<place_uuid>)addpc.Place.add(‘name’, ‘description’, ‘latitude’, ‘longitude’, <accesskey>)updatepc.Place.update(<place_uuid>, ‘name’, ‘description’, ‘latitude’, ‘longitude’, <accesskey>)get_metapc.Place.get_meta([<uuid1>,<uuid2>])get_placespc.Place.get_places(<place_uuid>)update_placespc.Place.update_places(<place_uuid>, [<place_x_uuid>,<place_y_uuid>] , <accesskey>)Exception handlingControlled exceptions might occur -permissions denied,not found, etc. These exceptions are cought and re-thrown as aPlastError.try:pc.State.get(<non_existing_uuid>)except PlastError, e:print ePlastError har 3 properties:url  - the failed url.code - the returned http statuscode.msg  - a message.Changelog0.2.1Added support for the new Query APIMinor bugfixes0.2.0Support for moved meta endpoint in plast0.1.9Added get_meta function to Place for getting meta from a list of place uuidsMinor bugfixes0.1.8Expanding Place APIAdded AccessKey.places to get places associated with keyAdded Place.modify_root to modify root propertyAdded support for adding root property in Place.add0.1.7Added support for Place APIRemoved annoying print statement from State.update0.1.6Improved Stateset update protection and errorhandling.0.1.5Updated StateSet.update ignoring None values.0.1.4devFirst public release of plastclientStill under active developmentenjoy.