https://github.com/evensxia/localproxy
a simple proxy init tool in python code running
https://github.com/evensxia/localproxy
proxy tool
Last synced: about 2 months ago
JSON representation
a simple proxy init tool in python code running
- Host: GitHub
- URL: https://github.com/evensxia/localproxy
- Owner: EvensXia
- License: mit
- Created: 2024-08-01T10:09:32.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-09T06:20:48.000Z (almost 2 years ago)
- Last Synced: 2025-11-29T09:10:46.792Z (7 months ago)
- Topics: proxy, tool
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LocalProxy

LocalProxy is a Python command-line tool for managing and applying proxy configurations. It allows you to set, list, and clear proxy settings, which are stored in a configuration file and can be easily applied to your environment.
## Features
- Set HTTP and HTTPS proxy configurations
- List existing proxy configurations
- Clear all proxy configurations
- Apply proxy settings to the environment in other projects
## Installation
### from pypi
```bash
pip3 install pylocalproxy
```
### Prerequisites
- Python 3.8 or higher
- Poetry for package management
### Steps
1. Clone the repository:
```bash
git clone https://github.com/EvensXia/localproxy.git
cd localproxy
```
2. Install the project using Poetry:
```bash
poetry install
```
3. Build the project:
```bash
poetry build
```
4. Install the built wheel file:
```bash
pip install dist/localproxy-0.1.0-py3-none-any.whl
```
## Usage
### Command-Line Interface
- List existing proxy configurations:
```bash
localproxy list
```
- Set a proxy configuration:
```bash
localproxy set
```
Example:
```bash
localproxy set http http://localhost:8080
```
- Clear all proxy configurations:
```bash
localproxy clear
```
- Run scripts/code/modules:
```bash
localproxy /path/to/your/script.py
localproxy -c "import requests;print(requests.get('https://www.google.com'))"
localproxy -m your.module
```
- Print CLI help:
```bash
localproxy -h
```
### Using the Proxy in Other Projects
In your other Python projects, you can import and apply the proxy settings as follows:
```python
from localproxy import proxy
proxy.init()
```
This will apply the proxy settings stored in ~/.localproxy/proxy.toml to your environment variables.
### Configuration
Proxy configurations are stored in a TOML file located at ~/.localproxy/proxy.toml. This file is managed automatically by the CLI commands.