Skip to main content

socket_request is building and parsing HTTP requests with UNIX domain sockets.

Project description

socket_request

socket_request is build and parses HTTP requests with unix domain sockets.

Installing socket_request

socket_request is available on PyPI:

pip3 install socket-request

Officially supports Python 3.7+.

Examples:

import socket_request

docker = socket_request.DockerSock(unix_socket="/var/run/docker.sock")
docker.get_docker_images()
import socket_request

control_chain = socket_request.ControlChain(unix_socket="./cli.sock")
control_chain.stop()
control_chain.start()

CLI:

$ control_chain --help

    ╋╋╋╋╋╋╋╋╋┏┓╋╋╋╋╋┏┓╋╋╋╋┏┓
    ╋╋╋╋╋╋╋╋┏┛┗┓╋╋╋╋┃┃╋╋╋╋┃┃
    ┏━━┳━━┳━╋┓┏╋━┳━━┫┃╋┏━━┫┗━┳━━┳┳━┓
    ┃┏━┫┏┓┃┏┓┫┃┃┏┫┏┓┃┃╋┃┏━┫┏┓┃┏┓┣┫┏┓┓
    ┃┗━┫┗┛┃┃┃┃┗┫┃┃┗┛┃┗┓┃┗━┫┃┃┃┏┓┃┃┃┃┃
    ┗━━┻━━┻┛┗┻━┻┛┗━━┻━┛┗━━┻┛┗┻┛┗┻┻┛┗┛

	 version : 1.0.11
	 base_dir: /app/icon2-node


usage: control_chain [-h] [-s unixsocket] [-d] [-t timeout] [-w wait_state]
                     [-r retry] [-ws] [-ap auto_prepare] [-p payload_file]
                     [-f] [-i] [--seedAddress SEEDADDRESS] [-b BASE_DIR]
                     [-pd payload dict]
                    {start,stop,reset,leave,view_chain,view_system_config,join,backup,backup_list,restore,chain_config,system_config,ls,prune}

Command Line Interface for control_chain

positional arguments:
    {start,stop,reset,leave,view_chain,view_system_config,join,backup,backup_list,restore,chain_config,system_config,ls,prune}

optional arguments:
  -h, --help            show this help message and exit
  -s unixsocket, --unixsocket unixsocket
                        unix domain socket path (default:
                        /app/icon2-node/data/cli.socket)
  -d, --debug           debug mode. (default: False)
  -t timeout, --timeout timeout
                        timeout (default: 60)
  -w wait_state, --wait-state wait_state
                        wait_state (default: True)
  -r retry, --retry retry
                        wait_state (default: True)
  -ws, --wait-socket    wait for unix domain socket
  -ap auto_prepare, --auto_prepare auto_prepare
                        auto_prepare (default: True)
  -p payload_file, --payload payload_file
                        payload file
  -f, --forever         retry forever
  -i, --inspect         inspect for view chain
  --seedAddress SEEDADDRESS
                        seed list string
  -b BASE_DIR, --base-dir BASE_DIR
                        base dir for goloop
  -pd payload dict, --payload-dict payload dict
                        payload dict
  -bh BLOCKHEIGHT, --blockheight BLOCKHEIGHT
    BlockHeight for pruning
  -rn RESTORE_NAME, --restore-name RESTORE_NAME
    Restore filename for restore 

ConnectSock

  • ConnectSock class
  • request(self, method="GET", url=None, headers={}, payload={}, files={}, return_dict=False) method

ControlChain

Parent class is ConnectSock class

  • ControlChain class
  • start() method
  • stop() method
  • reset() method
  • leave() method
  • backup() method
  • backup_list() method
  • restore(name="name") method
  • join(seed_list=["127.0.0.1:7100"], role=3) method
  • view_chain(detail=False, inspect=False) method
  • chain_config(payload={"key": "autoStart", "value": "true"}) method
  • view_system_config() method
  • system_config(payload={"key": "rpcIncludeDebug", "value": "true"}) method

DockerSock

Parent class is ConnectSock class

  • DockerSock class

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

socket_request-1.1.18-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file socket_request-1.1.18-py3-none-any.whl.

File metadata

File hashes

Hashes for socket_request-1.1.18-py3-none-any.whl
Algorithm Hash digest
SHA256 98a944359c6778421424caf2a40b2244729027bbab06a347046e767370af80c6
MD5 2d7c84798eab0ab717acabdf1b490ec8
BLAKE2b-256 edc9e3c03c01b5863b4a5006a5d8aac5858ba48c729e3d8d52a114e80d33f729

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page