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

Uploaded Source

File details

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

File metadata

  • Download URL: sowerest-0.0.18.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.18.tar.gz
Algorithm Hash digest
SHA256 04473ace84f53cd71c4ae14521299db3a163eb7ab31b8fbe7edbe86627ebc8e2
MD5 d8e1b17cd138dc4b7f08781e6f3ab808
BLAKE2b-256 08e95409206aa88facdab07dfbefc14a95e99ea1219de84f0bb0ac8bfb8969cd

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