pawnlib


Namepawnlib JSON
Version 2.1.1 PyPI version JSON
download
home_pageNone
Summarypawnlib: A versatile Python library for Infrastructure as Code (IaC), offering tools for SSH monitoring, WebSocket connections, and more.
upload_time2025-02-23 23:53:39
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords python iac ssh monitoring python pawnlib tools
VCS
bugtrack_url
requirements asttokens certifi charset-normalizer devtools executing idna parameterized PyYAML requests six termcolor urllib3 asyncio aiometer pyfiglet deprecated argparse Jinja2 rich Pygments inquirerpy httpx boto3 aiohttp aiofiles python-dotenv tqdm toml psutil
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ♟️ Pawnlib

A versatile Python library for Infrastructure as Code (IaC). Monitor SSH logs, manage WebSocket connections, and automate tasks with ease.

A collection of libraries that can be used like pawns on a chessboard.
Pawnlib is a collection of libraries for IaC.

It provides a collection of utility functions and classes that aim to enhance productivity and streamline code development. The library is particularly useful for developers looking to reduce repetitive coding patterns and improve code readability.

utils, globals vars, logging, http, network, pretty printing, resource, converter ...


[![Build Docker Images](https://github.com/JINWOO-J/pawnlib/actions/workflows/docker-push.yml/badge.svg)](https://github.com/JINWOO-J/pawnlib/actions/workflows/docker-push.yml)
[![Docs](https://github.com/JINWOO-J/pawnlib/actions/workflows/docs-publish.yml/badge.svg)](https://github.com/JINWOO-J/pawnlib/actions/workflows/docs-publish.yml)
[![pages-build-deployment](https://github.com/JINWOO-J/pawnlib/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/JINWOO-J/pawnlib/actions/workflows/pages/pages-build-deployment)

[![PyPI version](https://badge.fury.io/py/pawnlib.svg)](https://badge.fury.io/py/pawnlib)

<p align="center">
	<img src="https://img.shields.io/github/last-commit/JINWOO-J/pawnlib?style=default&logo=git&logoColor=white&color=0080ff" alt="last-commit">
	<img src="https://img.shields.io/github/languages/top/JINWOO-J/pawnlib?style=default&color=0080ff" alt="repo-top-language">
	<img src="https://img.shields.io/github/languages/count/JINWOO-J/pawnlib?style=default&color=0080ff" alt="repo-language-count">
<p>


### Installing pawnlib
- **Installing pawnlib**

pawnlib is available on PyPI:

```
pip3 install pawnlib

```

pawnlib with wallet is available on PyPI:

```
pip3 install pawnlib[wallet]

```

## Global Config
-  **Global Config**

You can use the global config. 

```python
from pawnlib.config.globalconfig import pawnlib_config as pawn
from pawnlib.output import *


def main():
    current_path = get_script_path(__file__)
    log_time_format = '%Y-%m-%d %H:%M:%S.%f'
    app_name = "default_app"
    stdout = True
    pawn.set(
        PAWN_PATH=current_path,        
        PAWN_TIME_FORMAT=log_time_format,
        PAWN_LOGGER=dict(
            log_level="INFO",
            stdout_level="INFO",
            log_path=f"{current_path}/logs",
            stdout=stdout,
            use_hook_exception=True,
        ),
        PAWN_CONSOLE=dict(
            redirect=True,
            record=True,
            log_time_format=f"%Y-%m-%d %H:%M:%S.%f",
        ),
        PAWN_DEBUG=True, # Don't use production, because it's not stored exception log.
        PAWN_VERBOSE=3,
        app_name=app_name,
        app_data={},
    )
    
    pawn.console.log("START APP")
    pawn.console.log(pawn.to_dict())

```
### pawns

`pawns` CLI supports the following commands: icon, server, proxy, net, top, docker, aws, rpc, http, gs, init, info, banner, websocket, wallet.


```
$ pawns 
--------------------------------------------------

__________  _____  __      _________    _________
\______   \/  _  \/  \    /  \      \  /   _____/
 |     ___/  /_\  \   \/\/   /   |   \ \_____  \
 |    |  /    |    \        /    |    \/        \
 |____|  \____|__  /\__/\  /\____|__  /_______  /
                 \/      \/         \/        \/

 - Description :
 - Version     : 2.0.15
 - Author      : jinwoo

--------------------------------------------------


The pawns is designed to serve as the main command-line interface (CLI)

optional arguments:
  -h, --help            show this help message and exit


sub-module:
  {icon,server,proxy,net,top,docker,aws,rpc,http,gs,init,info,banner,websocket,wallet}
    icon                icon module
    server              This command is used to check and verify the server’s resources.
    proxy               A Proxy Reflector Tool
    net                 This is a tool to measure your server's resources.
    top                 This is a tool to measure your server's resources.
    docker              docker module
    aws                 Get meta information from AWS EC2.
    rpc                 This tool uses JSON remote procedure calls, or RPCs, commonly used on the ICON blockchain.
    http                This is a tool to measure RTT on HTTP/S requests.
    gs                  Genesis Tool
    init                Advanced Python application builder: Easily initialize your Python development environment with
                        customizable templates and best practices.
    info                This command displays server resource information.
    banner              Command to test the banner.
    websocket           Connect to the Goloop network with WebSocket to receive blocks.
    wallet              A tool for managing ICON wallets. It supports creating new wallets and loading existing ones.
```



### app builder 
- **app builder** 

You can create a simple application based on pawnlib with the command below.


```bash

$ pawns init
[10:35:21,837] main_cli wrapper                                                                                               main_cli.py:117
[10:35:21,840] args = Namespace(proxy=None, init=Namespace(command='init')), command = init                                   main_cli.py:119

--------------------------------------------------


___.         .__.__       .___
\_ |__  __ __|__|  |    __| _/___________
 | __ \|  |  \  |  |   / __ |/ __ \_  __ \
 | \_\ \  |  /  |  |__/ /_/ \  ___/|  | \/
 |___  /____/|__|____/\____ |\___  >__|
     \/                    \/    \/

 - Description : Initialize Python Development Environment
 - Version     : 0.0.28
 - Author      : jinwoo


--------------------------------------------------

PWD = /Users/jinwoo/work/python_prj/pawnlib


What's your python3 app name? (default_app):
What's your name? (jinwoo):
Please explain this script. (This is script):
Project directory => /Users/jinwoo/work/python_prj/pawnlib ? [y/n] (y):
Do you want to logger? [y/n] (y):
Do you want to daemon? [y/n] (n):
```


### simple reflector proxy
- **simple reflector proxy**

Simple Python HTTP Server which reflects the client HTTP request header in server logs to see the header fields forwarded by web servers. 


```bash

$ pawns proxy -l 8080 -f 127.0.0.1:8200
[10:34:33,898] main_cli wrapper                                                                                               main_cli.py:117
[10:34:33,902] args = Namespace(proxy=Namespace(listen='8080', forward='127.0.0.1:8200', buffer_size=4096, delay=0.0001,      main_cli.py:119
               timeout=3), init=None), command = proxy

--------------------------------------------------



_____________  _______  ______.__.
\____ \_  __ \/  _ \  \/  <   |  |
|  |_> >  | \(  <_> >    < \___  |
|   __/|__|   \____/__/\_ \/ ____|
|__|                     \/\/
                _____.__                 __
_______   _____/ ____\  |   ____   _____/  |_  ___________
\_  __ \_/ __ \   __\|  | _/ __ \_/ ___\   __\/  _ \_  __ \
 |  | \/\  ___/|  |  |  |_\  ___/\  \___|  | (  <_> )  | \/
 |__|    \___  >__|  |____/\___  >\___  >__|  \____/|__|
             \/                \/     \/

 - Description : proxy reflector
 - Version     : 0.0.28
 - Author      : jinwoo


--------------------------------------------------

[10:34:33,904] args = Namespace(listen='8080', forward='127.0.0.1:8200', buffer_size=4096, delay=0.0001, timeout=3)              proxy.py:173
[10:34:33,905] Listen 0.0.0.0:8080 => Forward 127.0.0.1:8200

```

### httping
- **httping**

`http` module offers a streamlined and efficient way to perform HTTP requests and handle responses.

```bash

$ pawns http

--------------------------------------------------


.__     __    __         .__
|  |___/  |__/  |_______ |__| ____    ____
|  |  \   __\   __\____ \|  |/    \  / ___\
|   Y  \  |  |  | |  |_> >  |   |  \/ /_/  >
|___|  /__|  |__| |   __/|__|___|  /\___  /
     \/           |__|           \//_____/

 - Description : This is a tool to measure RTT on HTTP/S requests.
 - base_dir    : /Users/jinwoo/work/python_prj/pawnlib
 - logs_dir    : /Users/jinwoo/work/python_prj/pawnlib/logs

 - Version     : 1.0.84
 - Author      : jinwoo


--------------------------------------------------

[11:25:46,975] Invalid url: name=default, url=
usage: local_cli.py [-h] [-c CONFIG_FILE] [-v] [-q] [-i INTERVAL] [-m METHOD] [-t TIMEOUT] [-b BASE_DIR] [--success SUCCESS [SUCCESS ...]]
                    [--logical-operator {and,or}] [--ignore-ssl IGNORE_SSL] [-d DATA] [--headers HEADERS] [-w WORKERS] [--stack-limit STACK_LIMIT]
                    [--dynamic-increase-stack-limit DYNAMIC_INCREASE_STACK_LIMIT] [--slack-url SLACK_URL] [--log-level LOG_LEVEL] [-bk BLOCKHEIGHT_KEY]
                    [--dry-run]
                    [url]

httping

positional arguments:
  url                   URL to be checked


optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG_FILE, --config-file CONFIG_FILE
                        Path to the configuration file. Defaults to "config.ini".
  -v, --verbose         Enables verbose mode. Higher values increase verbosity level. Default is 1.
  -q, --quiet           Enables quiet mode. Suppresses all messages. Default is 0.
  -i INTERVAL, --interval INTERVAL
                        Interval time in seconds between checks. Default is 1 second.
  -m METHOD, --method METHOD
                        HTTP method to use (e.g., GET, POST). Default is "GET".
  -t TIMEOUT, --timeout TIMEOUT
                        Timeout in seconds for each HTTP request. Default is 10 seconds.
  -b BASE_DIR, --base-dir BASE_DIR
                        Base directory for httping operations. Default is the current working directory.
  --success SUCCESS [SUCCESS ...]
                        Criteria for success. Can specify multiple criteria. Default is ["status_code==200"].
  --logical-operator {and,or}
                        Logical operator for evaluating success criteria. Choices are "and", "or". Default is "and".
  --ignore-ssl IGNORE_SSL
                        Ignores SSL certificate validation if set to True. Default is True.
  -d DATA, --data DATA  Data to be sent in the HTTP request body. Expected in JSON format. Default is an empty dictionary.
  --headers HEADERS     HTTP headers to be sent with the request. Expected in JSON format. Default is an empty dictionary.
  -w WORKERS, --workers WORKERS
                        Maximum number of worker processes. Default is 10.
  --stack-limit STACK_LIMIT
                        Error stack limit. Default is 5.
  --dynamic-increase-stack-limit DYNAMIC_INCREASE_STACK_LIMIT
                        Dynamically increases the error stack limit if set to True. Default is True.
  --slack-url SLACK_URL
                        URL for sending notifications to Slack. Optional.
  --log-level LOG_LEVEL
                        Log level.
  -bk BLOCKHEIGHT_KEY, --blockheight-key BLOCKHEIGHT_KEY
                        JSON key to extract the blockheight information, e.g., 'result.sync_info.latest_block_height'. The script will check if the blockheight at
                        this path is increasing.
  --dry-run             Executes a dry run without making actual HTTP requests. Default is False.

This script provides various options to check the HTTP status of URLs.

Usage examples:
  1. Basic usage:
        pawns http https://example.com

  2. Verbose mode:
        pawns http https://example.com -v

  3. Using custom headers and POST method:
        pawns http https://example.com -m POST --headers '{"Content-Type": "application/json"}' --data '{"param": "value"}'

  4. Ignoring SSL verification and setting a custom timeout:
        pawns http https://example.com --ignore-ssl True --timeout 5

  5. Checking with specific success criteria and logical operator:
        pawns http https://example.com --success 'status_code==200' 'response_time<2' --logical-operator and

  6. Running with a custom config file and interval:
        pawns http https://example.com -c http_config.ini -i 3

    http_config.ini
    [default]
    success = status_code==200
    slack_url =
    interval = 3
    method = get
    ; data = sdsd
    data = {"sdsd": "sd222sd"}

    [post]
    url = http://httpbin.org/post
    method = post

    [http_200_ok]
    url = http://httpbin.org/status/200
    success = status_code==200

    [http_300_ok_and_2ms_time]
    url = http://httpbin.org/status/300
    success = ['status_code==300', 'response_time<0.02']

    [http_400_ok]
    url = http://httpbin.org/status/400
    success = ["status_code==400"]


  7. Setting maximum workers and stack limit:
        pawns http https://example.com -w 5 --stack-limit 10

  8. Dry run without actual HTTP request:
        pawns http https://example.com --dry-run

  9. Sending notifications to a Slack URL on failure:
        pawns http https://example.com --slack-url 'https://hooks.slack.com/services/...'

 10. Checking blockheight increase:
        pawns http http://test-node-01:26657/status --blockheight-key "result.sync_info.latest_block_height" -i 5

```

Officially supports Python 3.9+.

### Documentation

Documentation and tutorials are available at https://pawnlib.readthedocs.io

## Release Information


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pawnlib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "Python IaC, SSH monitoring Python, pawnlib tools",
    "author": null,
    "author_email": "Jinwoo <jinwoo@parametacorp.com>",
    "download_url": "https://files.pythonhosted.org/packages/1b/db/0ef55bc54b1812fef10116d83d88ce4cea03de569b9dee786c6a1a6679ee/pawnlib-2.1.1.tar.gz",
    "platform": null,
    "description": "# \u265f\ufe0f Pawnlib\n\nA versatile Python library for Infrastructure as Code (IaC). Monitor SSH logs, manage WebSocket connections, and automate tasks with ease.\n\nA collection of libraries that can be used like pawns on a chessboard.\nPawnlib is a collection of libraries for IaC.\n\nIt provides a collection of utility functions and classes that aim to enhance productivity and streamline code development. The library is particularly useful for developers looking to reduce repetitive coding patterns and improve code readability.\n\nutils, globals vars, logging, http, network, pretty printing, resource, converter ...\n\n\n[![Build Docker Images](https://github.com/JINWOO-J/pawnlib/actions/workflows/docker-push.yml/badge.svg)](https://github.com/JINWOO-J/pawnlib/actions/workflows/docker-push.yml)\n[![Docs](https://github.com/JINWOO-J/pawnlib/actions/workflows/docs-publish.yml/badge.svg)](https://github.com/JINWOO-J/pawnlib/actions/workflows/docs-publish.yml)\n[![pages-build-deployment](https://github.com/JINWOO-J/pawnlib/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/JINWOO-J/pawnlib/actions/workflows/pages/pages-build-deployment)\n\n[![PyPI version](https://badge.fury.io/py/pawnlib.svg)](https://badge.fury.io/py/pawnlib)\n\n<p align=\"center\">\n\t<img src=\"https://img.shields.io/github/last-commit/JINWOO-J/pawnlib?style=default&logo=git&logoColor=white&color=0080ff\" alt=\"last-commit\">\n\t<img src=\"https://img.shields.io/github/languages/top/JINWOO-J/pawnlib?style=default&color=0080ff\" alt=\"repo-top-language\">\n\t<img src=\"https://img.shields.io/github/languages/count/JINWOO-J/pawnlib?style=default&color=0080ff\" alt=\"repo-language-count\">\n<p>\n\n\n### Installing pawnlib\n- **Installing pawnlib**\n\npawnlib is available on PyPI:\n\n```\npip3 install pawnlib\n\n```\n\npawnlib with wallet is available on PyPI:\n\n```\npip3 install pawnlib[wallet]\n\n```\n\n## Global Config\n-  **Global Config**\n\nYou can use the global config. \n\n```python\nfrom pawnlib.config.globalconfig import pawnlib_config as pawn\nfrom pawnlib.output import *\n\n\ndef main():\n    current_path = get_script_path(__file__)\n    log_time_format = '%Y-%m-%d %H:%M:%S.%f'\n    app_name = \"default_app\"\n    stdout = True\n    pawn.set(\n        PAWN_PATH=current_path,        \n        PAWN_TIME_FORMAT=log_time_format,\n        PAWN_LOGGER=dict(\n            log_level=\"INFO\",\n            stdout_level=\"INFO\",\n            log_path=f\"{current_path}/logs\",\n            stdout=stdout,\n            use_hook_exception=True,\n        ),\n        PAWN_CONSOLE=dict(\n            redirect=True,\n            record=True,\n            log_time_format=f\"%Y-%m-%d %H:%M:%S.%f\",\n        ),\n        PAWN_DEBUG=True, # Don't use production, because it's not stored exception log.\n        PAWN_VERBOSE=3,\n        app_name=app_name,\n        app_data={},\n    )\n    \n    pawn.console.log(\"START APP\")\n    pawn.console.log(pawn.to_dict())\n\n```\n### pawns\n\n`pawns` CLI supports the following commands: icon, server, proxy, net, top, docker, aws, rpc, http, gs, init, info, banner, websocket, wallet.\n\n\n```\n$ pawns \n--------------------------------------------------\n\n__________  _____  __      _________    _________\n\\______   \\/  _  \\/  \\    /  \\      \\  /   _____/\n |     ___/  /_\\  \\   \\/\\/   /   |   \\ \\_____  \\\n |    |  /    |    \\        /    |    \\/        \\\n |____|  \\____|__  /\\__/\\  /\\____|__  /_______  /\n                 \\/      \\/         \\/        \\/\n\n - Description :\n - Version     : 2.0.15\n - Author      : jinwoo\n\n--------------------------------------------------\n\n\nThe pawns is designed to serve as the main command-line interface (CLI)\n\noptional arguments:\n  -h, --help            show this help message and exit\n\n\nsub-module:\n  {icon,server,proxy,net,top,docker,aws,rpc,http,gs,init,info,banner,websocket,wallet}\n    icon                icon module\n    server              This command is used to check and verify the server\u2019s resources.\n    proxy               A Proxy Reflector Tool\n    net                 This is a tool to measure your server's resources.\n    top                 This is a tool to measure your server's resources.\n    docker              docker module\n    aws                 Get meta information from AWS EC2.\n    rpc                 This tool uses JSON remote procedure calls, or RPCs, commonly used on the ICON blockchain.\n    http                This is a tool to measure RTT on HTTP/S requests.\n    gs                  Genesis Tool\n    init                Advanced Python application builder: Easily initialize your Python development environment with\n                        customizable templates and best practices.\n    info                This command displays server resource information.\n    banner              Command to test the banner.\n    websocket           Connect to the Goloop network with WebSocket to receive blocks.\n    wallet              A tool for managing ICON wallets. It supports creating new wallets and loading existing ones.\n```\n\n\n\n### app builder \n- **app builder** \n\nYou can create a simple application based on pawnlib with the command below.\n\n\n```bash\n\n$ pawns init\n[10:35:21,837] main_cli wrapper                                                                                               main_cli.py:117\n[10:35:21,840] args = Namespace(proxy=None, init=Namespace(command='init')), command = init                                   main_cli.py:119\n\n--------------------------------------------------\n\n\n___.         .__.__       .___\n\\_ |__  __ __|__|  |    __| _/___________\n | __ \\|  |  \\  |  |   / __ |/ __ \\_  __ \\\n | \\_\\ \\  |  /  |  |__/ /_/ \\  ___/|  | \\/\n |___  /____/|__|____/\\____ |\\___  >__|\n     \\/                    \\/    \\/\n\n - Description : Initialize Python Development Environment\n - Version     : 0.0.28\n - Author      : jinwoo\n\n\n--------------------------------------------------\n\nPWD = /Users/jinwoo/work/python_prj/pawnlib\n\n\nWhat's your python3 app name? (default_app):\nWhat's your name? (jinwoo):\nPlease explain this script. (This is script):\nProject directory => /Users/jinwoo/work/python_prj/pawnlib ? [y/n] (y):\nDo you want to logger? [y/n] (y):\nDo you want to daemon? [y/n] (n):\n```\n\n\n### simple reflector proxy\n- **simple reflector proxy**\n\nSimple Python HTTP Server which reflects the client HTTP request header in server logs to see the header fields forwarded by web servers. \n\n\n```bash\n\n$ pawns proxy -l 8080 -f 127.0.0.1:8200\n[10:34:33,898] main_cli wrapper                                                                                               main_cli.py:117\n[10:34:33,902] args = Namespace(proxy=Namespace(listen='8080', forward='127.0.0.1:8200', buffer_size=4096, delay=0.0001,      main_cli.py:119\n               timeout=3), init=None), command = proxy\n\n--------------------------------------------------\n\n\n\n_____________  _______  ______.__.\n\\____ \\_  __ \\/  _ \\  \\/  <   |  |\n|  |_> >  | \\(  <_> >    < \\___  |\n|   __/|__|   \\____/__/\\_ \\/ ____|\n|__|                     \\/\\/\n                _____.__                 __\n_______   _____/ ____\\  |   ____   _____/  |_  ___________\n\\_  __ \\_/ __ \\   __\\|  | _/ __ \\_/ ___\\   __\\/  _ \\_  __ \\\n |  | \\/\\  ___/|  |  |  |_\\  ___/\\  \\___|  | (  <_> )  | \\/\n |__|    \\___  >__|  |____/\\___  >\\___  >__|  \\____/|__|\n             \\/                \\/     \\/\n\n - Description : proxy reflector\n - Version     : 0.0.28\n - Author      : jinwoo\n\n\n--------------------------------------------------\n\n[10:34:33,904] args = Namespace(listen='8080', forward='127.0.0.1:8200', buffer_size=4096, delay=0.0001, timeout=3)              proxy.py:173\n[10:34:33,905] Listen 0.0.0.0:8080 => Forward 127.0.0.1:8200\n\n```\n\n### httping\n- **httping**\n\n`http` module offers a streamlined and efficient way to perform HTTP requests and handle responses.\n\n```bash\n\n$ pawns http\n\n--------------------------------------------------\n\n\n.__     __    __         .__\n|  |___/  |__/  |_______ |__| ____    ____\n|  |  \\   __\\   __\\____ \\|  |/    \\  / ___\\\n|   Y  \\  |  |  | |  |_> >  |   |  \\/ /_/  >\n|___|  /__|  |__| |   __/|__|___|  /\\___  /\n     \\/           |__|           \\//_____/\n\n - Description : This is a tool to measure RTT on HTTP/S requests.\n - base_dir    : /Users/jinwoo/work/python_prj/pawnlib\n - logs_dir    : /Users/jinwoo/work/python_prj/pawnlib/logs\n\n - Version     : 1.0.84\n - Author      : jinwoo\n\n\n--------------------------------------------------\n\n[11:25:46,975] Invalid url: name=default, url=\nusage: local_cli.py [-h] [-c CONFIG_FILE] [-v] [-q] [-i INTERVAL] [-m METHOD] [-t TIMEOUT] [-b BASE_DIR] [--success SUCCESS [SUCCESS ...]]\n                    [--logical-operator {and,or}] [--ignore-ssl IGNORE_SSL] [-d DATA] [--headers HEADERS] [-w WORKERS] [--stack-limit STACK_LIMIT]\n                    [--dynamic-increase-stack-limit DYNAMIC_INCREASE_STACK_LIMIT] [--slack-url SLACK_URL] [--log-level LOG_LEVEL] [-bk BLOCKHEIGHT_KEY]\n                    [--dry-run]\n                    [url]\n\nhttping\n\npositional arguments:\n  url                   URL to be checked\n\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -c CONFIG_FILE, --config-file CONFIG_FILE\n                        Path to the configuration file. Defaults to \"config.ini\".\n  -v, --verbose         Enables verbose mode. Higher values increase verbosity level. Default is 1.\n  -q, --quiet           Enables quiet mode. Suppresses all messages. Default is 0.\n  -i INTERVAL, --interval INTERVAL\n                        Interval time in seconds between checks. Default is 1 second.\n  -m METHOD, --method METHOD\n                        HTTP method to use (e.g., GET, POST). Default is \"GET\".\n  -t TIMEOUT, --timeout TIMEOUT\n                        Timeout in seconds for each HTTP request. Default is 10 seconds.\n  -b BASE_DIR, --base-dir BASE_DIR\n                        Base directory for httping operations. Default is the current working directory.\n  --success SUCCESS [SUCCESS ...]\n                        Criteria for success. Can specify multiple criteria. Default is [\"status_code==200\"].\n  --logical-operator {and,or}\n                        Logical operator for evaluating success criteria. Choices are \"and\", \"or\". Default is \"and\".\n  --ignore-ssl IGNORE_SSL\n                        Ignores SSL certificate validation if set to True. Default is True.\n  -d DATA, --data DATA  Data to be sent in the HTTP request body. Expected in JSON format. Default is an empty dictionary.\n  --headers HEADERS     HTTP headers to be sent with the request. Expected in JSON format. Default is an empty dictionary.\n  -w WORKERS, --workers WORKERS\n                        Maximum number of worker processes. Default is 10.\n  --stack-limit STACK_LIMIT\n                        Error stack limit. Default is 5.\n  --dynamic-increase-stack-limit DYNAMIC_INCREASE_STACK_LIMIT\n                        Dynamically increases the error stack limit if set to True. Default is True.\n  --slack-url SLACK_URL\n                        URL for sending notifications to Slack. Optional.\n  --log-level LOG_LEVEL\n                        Log level.\n  -bk BLOCKHEIGHT_KEY, --blockheight-key BLOCKHEIGHT_KEY\n                        JSON key to extract the blockheight information, e.g., 'result.sync_info.latest_block_height'. The script will check if the blockheight at\n                        this path is increasing.\n  --dry-run             Executes a dry run without making actual HTTP requests. Default is False.\n\nThis script provides various options to check the HTTP status of URLs.\n\nUsage examples:\n  1. Basic usage:\n        pawns http https://example.com\n\n  2. Verbose mode:\n        pawns http https://example.com -v\n\n  3. Using custom headers and POST method:\n        pawns http https://example.com -m POST --headers '{\"Content-Type\": \"application/json\"}' --data '{\"param\": \"value\"}'\n\n  4. Ignoring SSL verification and setting a custom timeout:\n        pawns http https://example.com --ignore-ssl True --timeout 5\n\n  5. Checking with specific success criteria and logical operator:\n        pawns http https://example.com --success 'status_code==200' 'response_time<2' --logical-operator and\n\n  6. Running with a custom config file and interval:\n        pawns http https://example.com -c http_config.ini -i 3\n\n    http_config.ini\n    [default]\n    success = status_code==200\n    slack_url =\n    interval = 3\n    method = get\n    ; data = sdsd\n    data = {\"sdsd\": \"sd222sd\"}\n\n    [post]\n    url = http://httpbin.org/post\n    method = post\n\n    [http_200_ok]\n    url = http://httpbin.org/status/200\n    success = status_code==200\n\n    [http_300_ok_and_2ms_time]\n    url = http://httpbin.org/status/300\n    success = ['status_code==300', 'response_time<0.02']\n\n    [http_400_ok]\n    url = http://httpbin.org/status/400\n    success = [\"status_code==400\"]\n\n\n  7. Setting maximum workers and stack limit:\n        pawns http https://example.com -w 5 --stack-limit 10\n\n  8. Dry run without actual HTTP request:\n        pawns http https://example.com --dry-run\n\n  9. Sending notifications to a Slack URL on failure:\n        pawns http https://example.com --slack-url 'https://hooks.slack.com/services/...'\n\n 10. Checking blockheight increase:\n        pawns http http://test-node-01:26657/status --blockheight-key \"result.sync_info.latest_block_height\" -i 5\n\n```\n\nOfficially supports Python 3.9+.\n\n### Documentation\n\nDocumentation and tutorials are available at https://pawnlib.readthedocs.io\n\n## Release Information\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "pawnlib: A versatile Python library for Infrastructure as Code (IaC), offering tools for SSH monitoring, WebSocket connections, and more.",
    "version": "2.1.1",
    "project_urls": {
        "Changelog": "https://github.com/jinwoo-j/pawnlib",
        "Documentation": "https://pawnlib.readthedocs.io",
        "Homepage": "https://pawnlib.readthedocs.io",
        "Source": "https://github.com/jinwoo-j/pawnlib"
    },
    "split_keywords": [
        "python iac",
        " ssh monitoring python",
        " pawnlib tools"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "03f4d6c1c3dea6bb8de5d3b233826bed3645c918805f484ad0607b916f679c6e",
                "md5": "1c2a3dcf29522742172d843b61e9d334",
                "sha256": "66ca860f5ca8f65dbece076baf43592a6098b12c7663a830230220ad12567f65"
            },
            "downloads": -1,
            "filename": "pawnlib-2.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1c2a3dcf29522742172d843b61e9d334",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 390597,
            "upload_time": "2025-02-23T23:53:37",
            "upload_time_iso_8601": "2025-02-23T23:53:37.355559Z",
            "url": "https://files.pythonhosted.org/packages/03/f4/d6c1c3dea6bb8de5d3b233826bed3645c918805f484ad0607b916f679c6e/pawnlib-2.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1bdb0ef55bc54b1812fef10116d83d88ce4cea03de569b9dee786c6a1a6679ee",
                "md5": "210f41e08767f939009294e33c2af8ac",
                "sha256": "d8d4878c80b8612e1458aa8b92b30dffdc732b8d6501d4e0b9c0ff9461491dfe"
            },
            "downloads": -1,
            "filename": "pawnlib-2.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "210f41e08767f939009294e33c2af8ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 346938,
            "upload_time": "2025-02-23T23:53:39",
            "upload_time_iso_8601": "2025-02-23T23:53:39.475544Z",
            "url": "https://files.pythonhosted.org/packages/1b/db/0ef55bc54b1812fef10116d83d88ce4cea03de569b9dee786c6a1a6679ee/pawnlib-2.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-23 23:53:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jinwoo-j",
    "github_project": "pawnlib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "asttokens",
            "specs": [
                [
                    ">=",
                    "2.0.5"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    ">=",
                    "2020.12.15"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    ">=",
                    "2.1.0"
                ]
            ]
        },
        {
            "name": "devtools",
            "specs": [
                [
                    ">=",
                    "0.8.0"
                ]
            ]
        },
        {
            "name": "executing",
            "specs": [
                [
                    ">=",
                    "0.8.3"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    ">=",
                    "2.5"
                ]
            ]
        },
        {
            "name": "parameterized",
            "specs": [
                [
                    ">=",
                    "0.8.1"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    ">=",
                    "5.3.1"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.25.0"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    ">=",
                    "1.15.0"
                ]
            ]
        },
        {
            "name": "termcolor",
            "specs": [
                [
                    ">=",
                    "1.1.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "~=",
                    "1.26.0"
                ]
            ]
        },
        {
            "name": "asyncio",
            "specs": [
                [
                    ">=",
                    "3.4.3"
                ]
            ]
        },
        {
            "name": "aiometer",
            "specs": [
                [
                    ">=",
                    "0.3.0"
                ]
            ]
        },
        {
            "name": "pyfiglet",
            "specs": [
                [
                    ">=",
                    "0.8.post1"
                ]
            ]
        },
        {
            "name": "deprecated",
            "specs": [
                [
                    "~=",
                    "1.2.13"
                ]
            ]
        },
        {
            "name": "argparse",
            "specs": [
                [
                    ">=",
                    "1.4.0"
                ]
            ]
        },
        {
            "name": "Jinja2",
            "specs": [
                [
                    ">=",
                    "3.0.3"
                ]
            ]
        },
        {
            "name": "rich",
            "specs": [
                [
                    ">=",
                    "12.0.1"
                ]
            ]
        },
        {
            "name": "Pygments",
            "specs": [
                [
                    ">=",
                    "2.14.0"
                ]
            ]
        },
        {
            "name": "inquirerpy",
            "specs": [
                [
                    "==",
                    "0.3.4"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    "~=",
                    "0.24.0"
                ]
            ]
        },
        {
            "name": "boto3",
            "specs": [
                [
                    "~=",
                    "1.28.3"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    "~=",
                    "3.10.3"
                ]
            ]
        },
        {
            "name": "aiofiles",
            "specs": [
                [
                    ">=",
                    "22.1.0"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    ">=",
                    "0.21.1"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": [
                [
                    "~=",
                    "4.65.0"
                ]
            ]
        },
        {
            "name": "toml",
            "specs": [
                [
                    "~=",
                    "0.10.2"
                ]
            ]
        },
        {
            "name": "psutil",
            "specs": [
                [
                    "~=",
                    "5.9.8"
                ]
            ]
        }
    ],
    "lcname": "pawnlib"
}
        
Elapsed time: 0.40752s