Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

api-session

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-session

requests.Session to work with JSON APIs

  • 1.4.2
  • PyPI
  • Socket score

Maintainers
1

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 or PyBigBuy.

It aims at factoring the common parts of these clients while staying very lightweight (<100 SLOC).

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
  • offline flag: if given, prevents the API from doing any call. This is useful for tests.
  • requests.Session inheritance: the class inherits from requests.Session, so it stays 100% compatible with it
  • (since 1.4) Response bodies are included in exception messages for 4xx errors. This behavior can be customized.

Install

pip install api-session

Or with Poetry:

poetry add api-session

Dependency: Python 3.8+.

Usage

from api_session import APISession

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

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc