Metadata-Version: 2.4
Name: nsopen
Version: 0.1.0
Summary: A tool to perform DNS lookup and open IP addresses in a browser
Author: Nelson Chan
License: MIT License
        
        Copyright (c) 2026 Nelson Chan
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Repository, https://github.com/khchanel/nsopen.git
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# nsopen

[![build](https://github.com/khchanel/nsopen/actions/workflows/python-app.yml/badge.svg)](https://github.com/khchanel/nsopen/actions/workflows/python-app.yml)

A command-line tool to perform DNS lookups and open resolved IP addresses in a web browser.

Particularly useful when you want to test behind a load balancer that resolves into multiple server IPs.

## Installation
```sh
python -m pip install .
```

## Usage

Note: pip packages executable directory should be in your PATH environmental variable

```sh
# Open all IPs for google.com using HTTPS (default)
nsopen google.com

# Open specific path /elmah.axd on example.com using HTTP protocol
nsopen -p http example.com /elmah.axd
```

if you didnt install, you can run it via python -m
may need to add src folder to PYTHONPATH env var if you are in a different directory
```sh
python -m nsopen google.com
```

### Example

```sh
nsopen -p https example.com /about
```

### Command line options

```
usage: nsopen [-h] [-p {http,https}] hostname [path]

Perform DNS lookup and open IP addresses in a browser

positional arguments:
  hostname              The hostname to lookup
  path                  [Optional] path to append to the URL (e.g. /elmah.axd)

options:
  -h, --help            show this help message and exit
  -p, --protocol {http,https}
                        The URL protocol to use (default: https)
```

## Development

### Setup

```sh
# Install dev dependencies
pip install -r requirements-dev.txt

# (optional) install package in editable mode for CLI entry point
pip install -e .
```

### Test

If you didn't install the package, set `PYTHONPATH` so tests can import the `nsopen` package.

```powershell
# From the project root
$env:PYTHONPATH = "${PWD}\src"; pytest
```

### Tooling

Common tooling is configured in `pyproject.toml`:

- black (code formatting)
- isort (import sorting)
- flake8 (linting)
- pytest (test runner defaults)

Run them as needed, e.g.:

```powershell
black .
isort .
flake8
pytest
```
