Skip to main content

Lightweight URL mapper and proxy with optional DNS helper for local testing

Project description

pyurlmapper

URLMapper — lightweight library to map and proxy URLs and optionally provide a small DNS mapper for local testing.

Features

  • URLMapper: simple HTTP proxy to map alias URL -> target URL (handles headers, query strings, binary bodies, streaming).
  • DNSMapper: minimal DNS responder using dnslib for mapping hostnames to IPs (useful for local networks/tests).
  • Ready-to-publish packaging (pyproject, setup.py, LICENSE, README).

Install (development)

pip install -e .
# or for runtime:
pip install flask requests dnslib

Quick example

from urlmapper import URLMapper, DNSMapper

# DNS (optional): resolve web.servermon -> 192.168.15.9 (for clients you control)
dns = DNSMapper()
dns.add_record("web.servermon", "192.168.15.9")
dns.start_background(listen_host="0.0.0.0", port=5353)  # uses 5353 for tests (non-root)

# Proxy: forward requests from alias to real service
mapper = URLMapper()
mapper.translate_url("http://192.168.15.9:5000", "http://web.servermon:5000")
mapper.run(host="0.0.0.0", port=5000)

See tests/example_usage.py for a runnable example.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyurlmapper-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyurlmapper-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pyurlmapper-0.1.0.tar.gz.

File metadata

  • Download URL: pyurlmapper-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyurlmapper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 585132041bbac6f5fab47504e9edfc126138cd54e3c1f6209356446ff4d61283
MD5 6f48a4a4d3c766630ba7e4ecfd3c3c26
BLAKE2b-256 3c1368cef44d688bb7942b1e50b52373a8add418edec5dbc54d2a08385cc6363

See more details on using hashes here.

File details

Details for the file pyurlmapper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyurlmapper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyurlmapper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10772d5ab5cad7563ff8f1b112424e310c27acfb4dc122764db73ea708c81544
MD5 04ab72dd46000250b293060a8ddbacb2
BLAKE2b-256 347d875feb28f1ddcfa711d6dc27a73a4d23c875a186d85b1398403ba0edb032

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page