Skip to main content

Lib for call RestApi services

Project description

LIB API ALTITUDE
================

This lib is used for call RestApi services.

## Installing

In your python environment use this command:

```bash
$ pip install restapi-client
```

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

```bash
$ python setup.py install
```

## Usage


Format of calls:

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

Example:

```python
>> 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.

### Headers:

* **X-Reference-Levels**: Indicates what is the level of information that
must be returned Use the parameter `level` in the methods.

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

restapi-client-0.0.1.tar.gz (2.4 kB view hashes)

Uploaded Source

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