IWC is a lightweight, zero-dependency Python utility designed to mirror and cache any URL or API endpoint. It runs a background worker to fetch data at a set interval, stores it in memory and on disk, and serves it via a built-in high-performance web server.
It is perfect for bypassing rate limits, providing offline redundancy for critical configurations, or mirroring subscription links in restricted network environments.
- Zero Dependencies: Uses only the Python Standard Library (
http.server,urllib). Nopip installrequired. - Background Refresh: Automatically updates the cache in a separate thread without blocking requests.
- Disk Persistence: Saves the last successful fetch to a local file. If the server restarts or the source is down, IWC serves the last known good data.
- Rate Limit Protection: Act as a middleman to protect your source API from being overwhelmed by too many clients.
- Health Monitoring: Includes a
/statusendpoint to verify the cache state and uptime. - Network Ready: Configured to bind to
0.0.0.0to allow access across your local network or VPS.
Since IWC uses pure Python, setup is as simple as downloading the script.
-
Download the script:
curl -O https://raw.githubusercontent.com/your-username/IWC/main/iwc.py
-
Configure your settings: Open
iwc.pyand edit the configuration block at the top:SOURCE_URL = "https://api.example.com/data.json" UPDATE_INTERVAL = 300 # Seconds (5 minutes) PORT = 5000 # Port to serve on
-
Run the server:
python3 iwc.py
Once running, the server provides two primary endpoints:
| Endpoint | Description |
|---|---|
GET / |
Returns the raw cached content from the source URL. |
GET /status |
Returns a JSON object showing if the cache is active and healthy. |
- API Mirroring: Cache a public API (like weather or crypto prices) to avoid hitting usage quotas.
- Config Distribution: Host a central configuration file that multiple devices need to read frequently.
- Subscription Mirror: Re-host subscription links or manifest files that are frequently updated but occasionally unreachable.
IWC is built with a "Serve-at-all-costs" philosophy:
- Memory First: Serves data instantly from RAM.
- Disk Backup: If RAM is empty on boot, it checks the local
.datfile. - Graceful Failure: If the source URL goes down, IWC continues serving the last successful fetch until the source returns online.
Basically: "No-install, zero-dependency caching proxy."