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.2.1.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file api-session-1.2.1.tar.gz
.
File metadata
- Download URL: api-session-1.2.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.11.0-1028-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc9b0c4c568ca0b4f2a00ef9f2000712df16172453f5f4ccccbad098d3f3a47d |
|
MD5 | 03afe517eb13ba693b427b0b2fe1c191 |
|
BLAKE2b-256 | e140afb3f9fbb25ee05bcdad1c4e1d898629797ba53c9ca8a10a8ed5df849714 |
File details
Details for the file api_session-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: api_session-1.2.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.11.0-1028-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c13dce5195b1ccc5cffd11fae647607c54f0d15743ac46d45c06cac755d015 |
|
MD5 | e58f5aa3b94f6e9ecc42f5698a1c9668 |
|
BLAKE2b-256 | 793a79e308b8c435fdb8e584407ee801fe9b57fb6ceb4c74f1e9edc9234898f7 |