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

Uploaded Source

File details

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

File metadata

  • Download URL: sowerest-0.0.12.tar.gz
  • Upload date:
  • Size: 6.5 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.7.7

File hashes

Hashes for sowerest-0.0.12.tar.gz
Algorithm Hash digest
SHA256 02546799813f026ea3292a1fb323cfbfb361b512b2d13b5652f0ee0c20aa7508
MD5 8c4c430d6324cb42fa69e93cccdddc61
BLAKE2b-256 2dd43765a91ad2fc38da97c789295b5c616ccda9c1f44705222c9b7813716f5b

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