Automate egress through WeProxy with the standard requests library — the default choice for Python scrapers, notebooks, and ETL jobs.
A single script that:
- Builds
http://USER:PASS@gw.weproxy.com.tr:8989 - Passes it as both
httpandhttpsentries inproxies= - Hits an IP echo URL and prints the exit address
Ideal as a connectivity canary before you wire WeProxy into Scrapy, httpx, or custom crawlers.
- Python 3.9+
- Panel credentials from my.we1.town
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
# source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .envExport credentials (the sample reads the process environment, not the file parser):
export WEPROXY_USER="your-user"
export WEPROXY_PASS="your-pass"PowerShell:
$env:WEPROXY_USER="your-user"
$env:WEPROXY_PASS="your-pass"python src/check_ip.pyimport requests
proxy = "http://USER:PASSWORD@gw.weproxy.com.tr:8989"
proxies = {"http": proxy, "https": proxy}
print(requests.get("https://api.ipify.org", proxies=proxies, timeout=30).text)Env-aware version: src/check_ip.py.
| Use case | Hint |
|---|---|
| Session reuse | requests.Session() + same proxies dict |
| Retries | Wrap with urllib3 Retry or tenacity; treat 407 as auth bug |
| Async | httpx / aiohttp with proxy URL — same gateway string |
| Scrapy | Set http_proxy / middleware auth from panel secrets |
| SOCKS5 | Needs requests[socks] and a SOCKS-enabled package |
Product line (residential vs datacenter) changes credentials, not the Python API. Compare on Pricing and Rotating residential.
| Symptom | Likely cause |
|---|---|
ProxyError |
Bad host/port, network path, or suspended package |
407 |
Wrong user/pass |
| Hangs | Raise timeout=; free proxies hang — paid gateway should not |
| Different IP each run | Expected on rotating packages |
cURL sanity check:
curl -x http://USER:PASSWORD@gw.weproxy.com.tr:8989 https://api.ipify.orgpython-proxy/
├── assets/banner.png
├── src/check_ip.py
├── requirements.txt
├── .env.example
└── README.md
MIT — see LICENSE.
