This package implements a simple HTTP(S) proxy.
Project description
SimpleHttpProxy
Description
This package implements a simple and partially asynchronous HTTP(S) proxy.
Requirements
This package require:
- python3
- python3 Standard Library
Installation
pip install SimpleHttpProxy
Usages
Default proxy printer using command line
python3 SimpleHttpProxy.py -h
python3 ProxyPrinter.pyz --help
ProxyPrinter --interface 0.0.0.0 --port 8012 --unsecure
ProxyPrinter -i 0.0.0.0 -p 8012 -s
Custom proxy using Python
Proxy Server:
from SimpleHttpProxy import AbcHttpProxy
class ProxyRestrict(AbcHttpProxy):
def handle_request(self, data: bytes) -> bytes:
if b'://www.ruby-lang.org' in data.split(b"\r\n", 1)[0]:
return data.replace(b'www.ruby-lang.org', b'www.python.org', 2)
return data
def handle_response(self, data: bytes) -> bytes:
return data.replace(b'www.ruby-lang.org', b'www.python.org')
proxy = ProxyRestrict()
proxy.start()
Python Client:
from urllib.request import Request, urlopen
r = Request("http://ruby-lang.org/")
r.set_proxy('127.0.0.1:8012', 'http')
print(urlopen(r).read()[3150:4000].decode())
Screenshot
Links
Licence
Licensed under the GPL, version 3.
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 Distribution
SimpleHttpProxy-0.0.2.tar.gz
(565.4 kB
view details)
File details
Details for the file SimpleHttpProxy-0.0.2.tar.gz
.
File metadata
- Download URL: SimpleHttpProxy-0.0.2.tar.gz
- Upload date:
- Size: 565.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14e261117cc5a969f5c2d59b16820c080ca44a8e35b5c78fd723f72c7045a693 |
|
MD5 | a3a8d317159ee498e9738c7db753dd92 |
|
BLAKE2b-256 | 0a5d63eea9ce0bac2093a3ef8c75767a857285409221b7405f33c6ff7475e5ae |