github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

sixapart / remoteobjects

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 128
    • 3
  • Source
  • Commits
  • Network (3)
  • Issues (3)
  • Downloads (2)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • gh-pages
    • master ✓
  • Tags (2)
    • release-1.1
    • release-1.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

An object RESTational model — Read more

  cancel

http://sixapart.github.com/remoteobjects/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Release metadata; added changelog. 
bradchoate (author)
Mon Nov 23 14:46:11 -0800 2009
commit  cba5699dbda028e03d7e4d97af3a1b4b0e24fc3e
tree    8817fe7aac2132f82f582d4f0353a9c107ad2b53
parent  4f388f987b8e760986c5c8fb3ed6588aa4a77822
remoteobjects /
name age
history
message
file .gitignore Mon Aug 31 16:00:30 -0700 2009 Start a .gitignore file [markpasc]
file CHANGES.rst Mon Nov 23 14:46:11 -0800 2009 Release metadata; added changelog. [bradchoate]
file LICENSE Tue Sep 29 15:25:36 -0700 2009 Add date to license file [markpasc]
file MANIFEST.in Mon Sep 28 16:32:59 -0700 2009 Change to an exclusive strategy for manifest bu... [markpasc]
file README.rst Mon Aug 24 14:34:22 -0700 2009 Update mini Twitter example in package docs [markpasc]
directory doc/ Mon Nov 23 14:46:11 -0800 2009 Release metadata; added changelog. [bradchoate]
directory examples/ Thu Sep 24 15:18:10 -0700 2009 Fix these interpreter directive lines [markpasc]
directory remoteobjects/ Mon Nov 23 14:46:11 -0800 2009 Release metadata; added changelog. [bradchoate]
file requirements.txt Thu Aug 20 12:27:05 -0700 2009 Pin versions of packaged requirements to known ... [markpasc]
file setup.py Mon Nov 23 14:46:11 -0800 2009 Release metadata; added changelog. [bradchoate]
file stdeb.cfg Thu Sep 17 13:42:27 -0700 2009 Add config file for stdeb [apparentlymart]
directory tests/ Thu Sep 24 15:18:10 -0700 2009 Fix these interpreter directive lines [markpasc]
README.rst

remoteobjects are real subclassable Python objects on which you can build a rich API library.

remoteobjects provides easy coding and transfer between Python objects and a JSON REST API. You can define the resources in a RESTful API as RemoteObject classes and their properties. These objects then support using the basic HTTP verbs to request and submit data to the API.

remoteobjects have:

  • programmable conversion between Python objects and your API's JSON resource format
  • full and correct HTTP support through the httplib2 library, including caching and authentication
  • delayed evaluation of objects to avoid unnecessary requests

Example

For example, you can build a simplified Twitter API library in the shell:

>>> from remoteobjects import RemoteObject, fields, ListObject
>>> class Tweeter(RemoteObject):
...     name        = fields.Field()
...     screen_name = fields.Field()
...     location    = fields.Field()
...
>>> class Tweet(RemoteObject):
...     text    = fields.Field()
...     source  = fields.Field()
...     tweeter = fields.Object(Tweeter, api_name='user')
...
>>> class Timeline(ListObject):
...     entries = fields.List(fields.Object(Tweet))
...
>>> tweets = Timeline.get('http://twitter.com/statuses/public_timeline.json')
>>> [t.tweeter.screen_name for t in tweets.entries[0:3]]
['eddeaux', 'CurtisLilly', '8email8']

For web APIs

remoteobjects is your Object RESTational Model for web APIs. You can define each type of resource as a RemoteObject subclass, with all the resource's member data specified as remoteobjects.field.Field instances for lightweight typing.

As provided, remoteobjects works with JSON REST APIs. Such an API should be arranged as a series of resources available at URLs as JSON entities (generally objects). The API server should support editing through POST and PUT requests, and return appropriate HTTP status codes for errors.

The remoteobjects module is not limited to a particular kind of API. The RemoteObject interface is provided in DataObject, HttpObject, and PromiseObject layers you can reuse, extend, and override to tailor objects to your target API.

Dictionaries with methods

While you can use an HTTP module and plain JSON coding to convert API resources into dictionaries, remoteobjects gives you real objects with encapsulated behavior instead of processing with external functions. A RemoteObject instance's behavior is clearly packaged in your RemoteObject subclass, where it is not only enforced through use of the object interface but extensible and replaceable through plain old subclassing.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server