Skip to main content

A generic python REST client

Reason this release was yanked:

premature release

Project description

A Python project for sending requests to REST APIs.

Overview

This project aims to build ORM wrappers around REST interfaces, by separating the configuration from the business logic. For

For example, taking the JSONplaceholder test site, there is a URL http://https://jsonplaceholder.typicode.com/posts?userId=1

To query this rsource, some text formatting magic needs to be combined with the requests module, after which the results need to be parsed.

An easier solution

Would it not be a lot easier to use this format

import jsonplaceholder as jp

list_of_pots = jp.filter_posts.fetch(user_id=1)
print list_of_posts

To achieve this, we need only this code:

from rest_client import API, APIConfig

class JsonPlaceHolderConfig(APIConfig):
    url = 'https://jsonplaceholder.typicode.com'
    filter_posts = ResourceConfig(path=['posts'],
                                  method='GET',
                                  description='retrieve all posts by filter criteria',
                                  parameters={ 'user_id': QueryParameter(name='userId',
                                                                         required=False,
                                                                         description='the user Id that made the post'),
                                                                         }
                                )

config =  JsonPlaceHolderConfig()
jp  = API(config)
list_of_pots = jp.filter_posts.fetch(user_id=1)

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

qrest-3.0.0.tar.gz (20.4 kB view hashes)

Uploaded Source

Built Distribution

qrest-3.0.0-py2.py3-none-any.whl (32.7 kB view hashes)

Uploaded Python 2 Python 3

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