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.17.tar.gz (8.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: sowerest-0.0.17.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.17.tar.gz
Algorithm Hash digest
SHA256 21463b2a401565adfa3696e110691cf5c9db10a3a7326fe01954644a6e198f40
MD5 2a658954a6b9735ce7f1ffcc3878419d
BLAKE2b-256 c633e30a98d4c417fd8d7e54d1dd1560bde786c248ee9c70a56b71f669f41823

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