Skip to main content

PyPI version Build Status Coverage Status

PSocket

The cross-platform simple tool to work with remote server through sockets. It can establish socket connection to a remote host:port, send commands and receive response. No need to send byte-string. Use usual strings to send command.

Installation

For most users, the recommended method to install is via pip:

pip install psocket

or from source:

python setup.py install

Import

from psocket import SocketClient

Usage

from psocket import SocketClient

client = SocketClient(host='172.16.0.48', port=3261)
print(client)
from psocket import SocketClient

client = SocketClient(host='172.16.0.48', port=3261, initialize=True)
print(client.send_command('<commands>'))

Changelog

1.1.4 (29.05.2023)
  • debug log extended with timeout error
  • global timeout management added
1.1.3 (26.05.2023)
  • Reading completion from the socket fixed
  • buffer size reduced to 4k
  • Logger extended
  • Refactoring
1.1.2 (25.05.2023)
  • buffer size increased to 8k
  • debug log added
1.1.1 (04.08.2022)
  • Detect command is completed by \n\n
1.1.0 (23.07.2022)
  • log format changed
1.0.9 (4.06.2022)
  • response now split lines (instead of .split('\n'))
  • logger now is static SocketClient
  • "greeting" class attr added
  • minor changes in logging format
  • socket timeout log level changed from debug to warning
1.0.8 (22.04.2022)
  • Set blocking after command send with it
1.0.7 (18.04.2022)
  • ._socket_response() renamed to ._receive_all() and changed to read huge amount of data from socket
  • buffer size changed to 4k (instead of 64k)
  • .send_command() extended with "timeout=None" param
1.0.6 (17.04.2022)
  • refactored to manage logger state
1.0.5 (6.04.2022)
  • logger moved inside class as attr in order to get access to it from outside
  • unknown attr access handling added
1.0.4 (14.06.2021)

Added host address logging

1.0.3 (12.03.2021)
  • Added ability to disable logs
  • "timeout connection" added as parameter with None default value
1.0.2 (15.01.2020)

Added "initialize" param to the constructor

1.0.1 (15.01.2020)
  • "is_host_available()" renamed to "is_socket_available()" and updated
  • used external logger from "plogger" package
1.0.0a4 (15.01.2020)
  • added init docstring
  • init notation changed:
    • host is string
    • port is integer
1.0.0a3 (14.01.2020)
  • removed timeout from socket connection
  • greeting and socket_response now are private methods
1.0.0a2 (13.01.2020)

Reverted "client". Now it is an attribute again to keep session alive

1.0.0a1 (13.01.2020)
  • Now connection creates with client property
  • New methods added:
    • is_host_available()
    • get_sock_name()
    • get_peer_name()
1.0.0a0 (13.01.2020)
  • initial commit

Metadata

Release files for psocket 1.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for psocket 1.1.4
File Size Uploaded Provenance Actions
psocket-1.1.4.tar.gz 5.4 kB Without provenance Details for psocket-1.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for psocket 1.1.4
File Interpreter ABI Platform Actions
psocket-1.1.4-py3-none-any.whl Python 3 none any Details for psocket-1.1.4-py3-none-any.whl

Total release size: 10.9 kB

Release files / psocket-1.1.4.tar.gz

Download URL psocket-1.1.4.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
086013dc1bf6b23378a7b5b4eaa624efc20b3860e757037d02e8b6bdb0bd18e7
BLAKE2b-256 checksum
How to use checksums
032997df60b7c1a692a0383dae45ee2228efe8fbfa01005f5d3ee677b120e72e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / psocket-1.1.4-py3-none-any.whl

Download URL psocket-1.1.4-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aafd43bb9181f4f9336daabf7c507209f80b5aad5ca5bd02fe0fca97e5b7166b
BLAKE2b-256 checksum
How to use checksums
a0addc00a661291b3a1c1b36caa2e42bc2eb02028c7cb1662a013e002b473de2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for psocket 1.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page