Skip to content

hubchenko/RESTclient

Repository files navigation

RESTclient

A Python client providing primitive methods for consuming a REST API The intent of this class is for it to be inherited by other subclasses

Prerequisites

  • Linux Ubuntu 14.04 server
  • Python 2.7

Installation

wget -O install.sh https://github.com/raw/hubchenko/RESTclient/master/install.sh
chmod +x install.sh
sudo ./install.sh venv
# Note: the argument venv is optional but recommended - if specified will install all packages in a Python virtual environment

Usage

$ python
>>> from RESTclient import RESTclient
>>> client = RESTclient('location of REST api', username='user', password='pass')

# GET request
>>> client.get('/rest/endpoint1')

# POST request
>>> client.post('/rest/endpoint2', json_data={'a1': 'v1'})

# PUT request with noop
>>> client.put('/rest/endpoint3', json_data={'a1': 'v1'}, noop=True)

# DELETE request with no SSL verification
>>> client.delete('/rest/endpoint4', verify=False)

Development Server Installation

Clone the repository

git clone https://github.com/hubchenko/RESTclient.git
cd RESTclient

Install packages and dependencies

chmod +x build.sh
sudo ./build.sh
source venv/bin/activate

Build the application

pyb

Link module for development

cd target/dist/RESTclient*/
python setup.py develop

Run unit tests

pyb run_unit_tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published