• Stars
    star
    191
  • Rank 202,877 (Top 4 %)
  • Language
    Python
  • License
    Other
  • Created about 15 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An object RESTational model

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.

More Repositories

1

angularjs-server

Specialized server for AngularJS sites
JavaScript
248
star
2

journald-cloudwatch-logs

Collects logs from journald and writes them to CloudWatch Logs as JSON
Go
160
star
3

django-kvstore

A key-value store framework for Django.
Python
82
star
4

seosuite

Automated Search Engine Optimization Testing Tool
Python
81
star
5

python-simpledb

Open Source Python library for accessing Amazon SimpleDB API
Python
79
star
6

angularjs-dynamic-form

AngularJS directive for creating dynamic forms based on schemas that aren't known until runtime
JavaScript
51
star
7

jobsworth

Buildkite pipeline planner
Go
40
star
8

terraform-buildkite

Terraform provider for Buildkite (work in progress)
Go
35
star
9

terraform-s3-dir

Generates a Terraform config to upload a directory of files to an Amazon S3 bucket
Go
30
star
10

batchhttp

Parallel HTTP through MIME multipart encoding
Python
27
star
11

TheSchwartz

Perl
22
star
12

consul-ec2-alb

Go
15
star
13

packer2terraform

packer2terraform turns Packer's machine-readable output into a Terraform tfvars file
Go
15
star
14

angularjs-humanize

AngularJS filters wrapping the 'humanize' library
JavaScript
10
star
15

packer-post-processor-template

A Packer post-processor to creates new files from templates.
Go
10
star
16

devops-tools

Perl
9
star
17

packer-buildkite

Packer post-processor to upload artifact ids to BuildKite metadata
Go
8
star
18

influxdb-relay

Simple UDP-to-HTTP proxy for writing data to InfluxDB
Go
7
star
19

rundeck-consul-resource-model

Generates Rundeck resource model XML from Consul registry
Go
6
star
20

css-standards

Tempest CSS Code Standards
6
star
21

variants-js

Mechanism for selectively enabling and disabling features in a JavaScript application
JavaScript
5
star
22

terraform-plus

A Docker build containing terraform + the provider plugins we use at Say
Dockerfile
4
star
23

ami-snapshot-cleanup

This cool tool cleans up snapshots that are not currently tied to an AMI.
Python
4
star
24

terraform-beanstalk

Terraform Plugin for Beanstalk
Go
3
star
25

seosuite-dashboard-ui

A front end for the seo dashboard.
JavaScript
3
star
26

AnyEvent-Peer39

AnyEvent client for Peer39's API
Perl
3
star
27

highland-find-json

Highland.js stream transformer to find JSON objects in a stream of buffers
JavaScript
3
star
28

SaySpider

A web crawler for profiling a site's SEO performance
Python
3
star
29

csv2template

csv2template transforms CSV files into Go templated text output
Go
2
star
30

angularjs-sdr

AngularJS alternative $route implementation that resolves routes via a server
2
star
31

terraform-consul-genconfig

Take YAML files and generate Terraform configs that in turn generate Consul keys
Go
2
star
32

node-connlimit

Artificially limit connections to NodeJS servers
JavaScript
1
star
33

seosuite-dashboard-api

The API endpoint for the seo crawler dashboard
Python
1
star
34

python-coal

Coalesce and/or Parallelize work via Promises
Python
1
star
35

node-influxdb-udp

NodeJS client for the InfluxDB UDP transport
JavaScript
1
star
36

highland-sucker

Utility to help with analyzing performance of Highland pipelines
JavaScript
1
star
37

stylelint-config-saymedia

Say Media's stylelint config
JavaScript
1
star
38

jenkins-flat-balls

Plugin for Jenkins to replace the status balls with flat circles
Java
1
star