Metadata-Version: 2.4
Name: localrun
Version: 1.1.3
Summary: A simple local HTTP server similar to php -S
Home-page: https://github.com/ByteBreach/localrun
Author: MrFidal
Author-email: mrfidal@proton.me
Project-URL: Bug Reports, https://github.com/ByteBreach/localrun/issues
Project-URL: Source, https://github.com/ByteBreach/localrun
Keywords: http server local development
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: project-url
Dynamic: requires-python
Dynamic: summary

# LocalRun

LocalRun is a Python package that provides an easy way to run a simple HTTP server locally, similar to the php -S command. It supports both silent and non-silent modes for logging HTTP requests.

## Installation

You can install localrun using pip :

```bash
pip install localrun
```

## Command-Line Usage

You can run the server directly from the command line using the following syntax :

### Start Server with Host and Port

```bash
localrun --host <HOST> --port <PORT>
```

### Start Server with Silent Mode

To run the server in silent mode, which suppresses log output :

```bash
localrun --host <HOST> --port <PORT> --silent
```

## Examples

### Start Server on Default Host and Port (127.0.0.1:8000)

```bash
localrun
```

### Start Server on Specified Host and Port

```bash
localrun --host 127.0.0.1 --port 8000
```

### Start Server with Silent Mode

```bash
localrun --host 127.0.0.1 --port 8000 --silent
```

## Programmatic Usage

You can also use localrun as a module in your Python scripts.

### Example Script

Here's how to start the server programmatically :

```python
# example_script.py
import localrun

# Start the server in silent mode
running_address = localrun.run_server('127.0.0.1', 8000, silent=True)

# Print the running address
print(f"Running port is: {running_address}")
```

### Running Without Silent Mode

To start the server without silent mode:

```python
# example_script.py
import localrun

# Start the server
running_address = localrun.run_server('127.0.0.1', 8000)

# Print the running address
print(f"Running port is: {running_address}")
```

## Logging Format

In non-silent mode, the server logs HTTP requests in the following format:

```
localrun - - [25/Oct/2024 23:01:50] "GET /new/instance/ HTTP/1.1" 200 -
```

## License

This project is licensed under the MIT License. See the LICENSE file for details.
