Code Monkey home page Code Monkey logo

restapi-client's Introduction

RESTAPI-CLIENT

This lib is used for call RestApi services.

Installing

In your python environment use this command:

$ pip install restapi-client

Or, you can make a local clone of this repository and install with this commands:

$ python setup.py install

Usage

Format of calls:

<myserver.com>.<endpoint>.[save,get(id),get_all,delete(id),update(id,data)]

Example:

>> from restapi import Client
>> api = Client()
>> ret = api.<endpointname>.get()
>> api.<endpointname>.save(dict_data)
>> ret = api.<endpointname>.get("<the_id>")
>> api.<endpointname>.update("<the_id>", dict_data)
>> api.<endpointname>.delete("<the_id>")

Methods

save( data ):

  • data: dictionary parameter with the record properties

get( [the_id] )

  • the_id: The id of the specific record

update( reg_id, user_data )

  • reg_id: The id of the specific record
  • user_data: dictionary parameter with properties that will be updated in the record
  • return: The updated record

delete( reg_id )

  • reg_id: The id of the specific record to be deleted
  • return: Nothing

OBS:

All methods have also the parameters user_params and user_headers when:

  • user_params: A dictionary object, that will be passed as uri parameters, like: http://servername.com/?param1=val1&param2=val2
  • user_headers: A dictionary object that wil be passwd as headers in the http call This lib does not support authentication

All methods return a restapi.ApiError if the call have problems.

Default Headers:

  • 'Content-Type': 'application/json'

restapi-client's People

Contributors

berlotto avatar joshuamsmith avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.