Skip to main content

REST Client Constructor

Project description

This package provides a simple mechanism for constructing clients for REST-based services. Every client extends the RESTClient class, and every method which hits the REST service is decorated with the @restmethod() decorator. The @restmethod() decorator causes the decorated method to be passed an additional argument (after the “self” argument): an HTTPRequest object. The method may then manipulate request headers and the body of the request, then use the send() method on the HTTPRequest object to issue the request. The return value of the send() method will be an httplib.HTTPResponse object, which can then be interpreted. If the response is a redirection, the redirection will be followed; if the response is an error (status code 400 or greater), an exception is raised.

JSON-based Clients

The rest package also includes the rest.jsclient module, which provides a JSONClient class geared toward those REST services which use JSON-encoded data. An additional _attach_obj() method is provided for JSONClient, and responses have any available valid JSON decoded and placed in the obj attribute of the response. (The body attribute of the response is additionally set to the content of the response, whether or not it is valid JSON.)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Requiem-0.1.tar.gz (13.1 kB view details)

Uploaded Source

File details

Details for the file Requiem-0.1.tar.gz.

File metadata

  • Download URL: Requiem-0.1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Requiem-0.1.tar.gz
Algorithm Hash digest
SHA256 c74d08fb5b40a63cc16836aaec845717096a6acf4974c31f4f15c2084f7bc743
MD5 5e314b01d6836ca60ab5e4baa922ad1a
BLAKE2b-256 4e0102931c567f3581c80c30989639aff1b55ccb81feed2ae2bf35efc5101425

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page