Skip to main content

A simple API client for connecting to remote services.

Project description

Simple Api Client

A simple API client for connecting to remote services.

Installation

Install and update using pipenv

pip install -U simple-api-client

Usage

from simple_api_client import ApiClient
from logging import Logger


logger = Logger("simple-logger", level="DEBUG")
client = ApiClient("http://www.example.com", logger)

response = client.get("/example/endpoint")

if response.status_code == 200:
    print(response.data)

Development

The build pipeline require your tests to pass and code to be formatted

Make sure you have Python 3.x installed on your machine (use pyenv).

Install the dependencies with pipenv (making sure to include dev and pre-release packages):

pipenv install --dev --pre

Configure your environment:

pipenv shell && export PYTHONPATH="$PWD"

Run the tests:

pytest

Or with logging:

pytest -s

Or tests with coverage:

pytest --cov=./

Format the code with Black:

black $PWD

Releases

Cleanup the (.gitignored) dist folder (if you have one):

rm -rf dist

Notch up the version number in setup.py and build:

python3 setup.py sdist bdist_wheel

Push to PyPi (using the ScholarPack credentials when prompted)

python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*

Links

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

simple-api-client-1.0.1.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

simple_api_client-1.0.1-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

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