Skip to content
SendGrid's Python HTTP Client for calling APIs
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github String Formatting and PEP-8 fixes Oct 24, 2018
examples Upgrade Python syntax with pyupgrade https://github.com/asottile/pyup… Oct 1, 2018
python_http_client Merge pull request #100 from moshemeirelles/conformance-style-standards Nov 14, 2018
static/img
tests remove dead code in profile.py Nov 1, 2018
use_cases
.codeclimate.yml Adding CodeClimate Feb 26, 2016
.dockerignore Add docker files and update README Oct 27, 2017
.env_sample
.gitignore String Formatting and PEP-8 fixes Oct 24, 2018
.travis.yml Deploy when tests pass, branch is master and tags are added Nov 14, 2018
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile Merge branch 'master' into rm-eol Oct 5, 2018
LICENSE.txt
MANIFEST.in String Formatting and PEP-8 fixes Oct 24, 2018
README.rst
TROUBLESHOOTING.md made grammer changes as per the grammerly suggestions Oct 5, 2018
USAGE.md
USE_CASES.md
VERSION.txt String Formatting and PEP-8 fixes Oct 24, 2018
auto_generate_release_notes.sh
cleanup.sh
docker-compose.yml Add docker files and update README Oct 27, 2017
first-timers.md
run.sh Add docker files and update README Oct 27, 2017
setup.py Add PEP8 code compliance according to pycodestyle Oct 26, 2018
tox.ini

README.rst

https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png

Build Status Email Notifications Badge Twitter Follow Codecov branch Code Climate Python Versions PyPI Version GitHub contributors MIT licensed

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

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

Table of Contents

Installation

Prerequisites

  • Python version 2.7 or 3.4+

Install Package

pip install python_http_client

or

easy_install python_http_client

API Key

Store your SendGrid 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 python_http_client

global_headers = {"Authorization": "Basic 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 python_http_client

global_headers = {"Authorization": "Basic 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

Roadmap

If you are interested in the future direction of this project, please take a look at our milestones. We would love to hear your feedback.

How to Contribute

We encourage contribution to our projects, please see our CONTRIBUTING guide for details.

Quick links:

Local Setup of the Project

The simplest local development workflow is by using docker.

  1. Install Docker
  2. Run docker-compose build (this builds the container)
  3. Run docker-compose up (this runs tests by default)

Troubleshooting

Please see our troubleshooting guide for any issues.

Announcements

All updates to this project is documented in our CHANGELOG.

Thanks

We were inspired by the work done on birdy and universalclient.

About

python-http-client is guided and supported by the SendGrid Developer Experience Team.

python-http-client is maintained and funded by SendGrid, Inc. The names and logos for python-http-client are trademarks of SendGrid, Inc.

License

The MIT License (MIT)

Career opportunities

If you're a software engineer who is passionate about #DeveloperExperience and/or #OpenSource, this is an incredible opportunity to join our #DX team as a Developer Experience Engineer and work with @thinkingserious and @aroach! Tell your friends :)

You can’t perform that action at this time.