Skip to main content

HTTP REST client, simplified for SeWeMail API

Project description

Build Status Codecov branch Code Climate Python Versions PyPI Version MIT licensed

Quickly and easily access any RESTful or RESTful-like API.

If you are looking for the sowemail API client library, please see this repo.

Table of Contents

Installation

Prerequisites

  • Python version 3.4+

Install Package

pip install sowerest

or

easy_install sowerest

API Key

Store your sowemail API key in a .env file.

cp .env_sample .env

Edit the .env file and add your API key.

Quick Start

Here is a quick example:

GET /your/api/{param}/call

import sowerest

global_headers = {"Authorization": "Bearer XXXXXXX"}
client = Client(host='base_url', request_headers=global_headers)
client.your.api._(param).call.get()
print(response.status_code)
print(response.headers)
print(response.body)

POST /your/api/{param}/call with headers, query parameters and a request body with versioning.

import sowerest

global_headers = {"Authorization": "Bearer XXXXXXX"}
client = Client(host='base_url', request_headers=global_headers)
query_params = {"hello":0, "world":1}
request_headers = {"X-Test": "test"}
data = {"some": 1, "awesome": 2, "data": 3}
response = client.your.api._(param).call.post(request_body=data,
                                              query_params=query_params,
                                              request_headers=request_headers)
print(response.status_code)
print(response.headers)
print(response.body)

Usage

Thanks

We were mainly inspired by the work done on python-http-client, birdy and universalclient.

License

The MIT License (MIT)

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

sowerest-0.0.19.tar.gz (8.0 kB view details)

Uploaded Source

File details

Details for the file sowerest-0.0.19.tar.gz.

File metadata

  • Download URL: sowerest-0.0.19.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.0

File hashes

Hashes for sowerest-0.0.19.tar.gz
Algorithm Hash digest
SHA256 5e87f86c55e172e299c3e026914b74a353437a5dbb1464e913942648d3897a9b
MD5 87a9da0f4bffeaaa70b4ea15f46178ab
BLAKE2b-256 fd8d672d4eacd168140ea0da3839a38d00cd1e371720afaba170fff714ddb6aa

See more details on using hashes here.

Supported by

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