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.
Metadata
Release files for remoteobjects 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| remoteobjects-1.2.1.tar.gz | 432.2 kB | Without provenance | Details for remoteobjects-1.2.1.tar.gz |
Release files / remoteobjects-1.2.1.tar.gz
| Download URL | remoteobjects-1.2.1.tar.gz |
|---|---|
| Size | 432.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f69c439b061f61306b72c0ac5cf4e026a6fa4a3d602434a7a875604a4ad3d009
|
|
BLAKE2b-256 checksum How to use checksums |
0c3805e006c165c5e495794008bdee38d7194f530cada337a83c18ccf8e2bffc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for remoteobjects 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.