Socket
Socket
Sign inDemoInstall

httpunixsocketconnection

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    httpunixsocketconnection

Really small Python class that extends native http.client.HTTPConnection allowing sending HTTP requests to Unix Sockets


Maintainers
1

Readme

HTTPUnixSocketConnection

Really small Python class that extends native http.client.HTTPConnection allowing sending HTTP requests to Unix Sockets

Installation

Poetry

poetry add httpunixsocketconnection

pip

pip install httpunixsocketconnection

Usage

Because the class base is http.client.HTTPConnection, the API is almost the same. Only the constructor and connect method is different. With the rest please follow the official docs.

from httpunixsocketconnection import HTTPUnixSocketConnection

# Create a connection
conn = HTTPUnixSocketConnection(
    unix_socket="/var/run/some.unix.socket"
    # timeout=Like in HTTPConnection
    # blocksize=Like in HTTPConnection
)

Example: Getting list of Docker Containers

from httpunixsocketconnection import HTTPUnixSocketConnection

conn = HTTPUnixSocketConnection("/var/run/docker.sock")
conn.request("GET", "/containers/json")

res = conn.getresponse()
print(res.status, res.reason)

content = res.read().decode("utf-8")
print(content)

Keywords

FAQs


Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc