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 fromrequests.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
Release history Release notifications | RSS feed
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.1.1.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for api_session-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40efca046587c7bc930824a4430c7f807a715c2c3ad44d46a498b928cde348a8 |
|
MD5 | 3d867aea05db89e8c3fd4aa8e6e8cd66 |
|
BLAKE2b-256 | bfa14392a33a8919d1c6f85a9d2291009e23c39028abdeddfac66845aeb05f84 |