Skip to main content

requests.Session to work with (JSON) APIs

Project description

api-session

api-session is a small module providing an extended requests.Session class to work with (JSON) APIs.

We use it at Bixoto as a basis for JSON API clients such as PyMagento.

Features

  • base URL: the base API URL is given only once on object creation; subsequent calls use .get("/path")
  • read-only flag: if given, prevents the API from doing POST and similar calls
  • requests.Session inheritance: the class inherits from requests.Session, so it stays 100% compatible with it

Install

pip install api-session

Dependency: Python 3.8+.

Usage

from api_session import APISession

client = APISession("https://httpbin.org")

client.get_json_api("/get")
# => {...}

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

api-session-1.2.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

api_session-1.2.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file api-session-1.2.0.tar.gz.

File metadata

  • Download URL: api-session-1.2.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.7 Linux/5.11.0-1028-azure

File hashes

Hashes for api-session-1.2.0.tar.gz
Algorithm Hash digest
SHA256 cc2084f5406baadfddb42d52ed267867e3fedd5d8b2c1a9b82d529e9f164ffa7
MD5 c1b14d2f6b543bcc8bb6c0c254956e81
BLAKE2b-256 19c673461d23f83f120dd0837a5351f339cfdc0879849a8a227d3d8bb2b99ff1

See more details on using hashes here.

File details

Details for the file api_session-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: api_session-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.7 Linux/5.11.0-1028-azure

File hashes

Hashes for api_session-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95be80a9d592c4906587b1bc4b7d6e09ee0aff7bf75012aad04471b13dd9aebe
MD5 58d39a6d7faee827d0a065ed6cfc3ccd
BLAKE2b-256 30dfbf15fe283696e83e8d6260b1e0438df891ab4d463cd53daf0f3ec5f7a5f2

See more details on using hashes here.

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