Your PythonAnywhere app calls partner APIs that enforce IP whitelisting, but its shared cloud infra rotates your outbound IP. Route requests and httpx calls through two fixed EU IPs with one HTTPS_PROXY env var.
# PythonAnywhere WSGI env
HTTPS_PROXY=https://user:pass@eu-01.outboundgateway.com:8443
import requests
resp = requests.get(
"https://api.partner.eu/data",
headers={"Authorization": "Bearer .."}
)
PythonAnywhere is a great Python host, but its shared cloud infrastructure means your app's outbound IP is dynamic. Partner APIs that enforce IP whitelisting block those rotating IPs.
Payment providers, CRMs, and enterprise APIs require IP whitelisting. When your PythonAnywhere app gets a new outbound IP from the shared pool, the whitelist breaks and API calls fail silently.
PythonAnywhere runs your Django, Flask, or web2py app on shared infrastructure. The outbound IP depends on which server the load balancer assigns, and it changes without warning.
PythonAnywhere doesn't offer a static outbound IP. You can't pin one through their dashboard or settings. You need an external proxy to give your app a predictable egress.
On PythonAnywhere's free and lower-tier plans, multiple apps share the same outbound IP pool. Your API calls inherit the reputation of other tenants on the same address, which can trigger rate limits or blocks.
The Python requests library (and httpx, urllib3) automatically reads HTTPS_PROXY from the environment. Set it once in your PythonAnywhere WSGI file and every outbound call your app makes leaves through your fixed EU IPs.
HTTPS_PROXY and your existing requests.get() calls work as-is.Set HTTPS_PROXY in your PythonAnywhere WSGI file. Your existing code works as-is.
Your existing view code works as-is. requests reads HTTPS_PROXY from the environment automatically.
# /var/www/yourusername_pythonanywhere_com_wsgi.py
import os
import requests
# Set the proxy at the top of your WSGI file
os.environ["HTTPS_PROXY"] = "https://user:pass@eu-01.outboundgateway.com:8443"
os.environ["PARTNER_API_TOKEN"] = "your_token"
# Then your existing app code works as-is
# requests honours HTTPS_PROXY automatically
resp = requests.get(
"https://api.partner.eu/data",
headers={"Authorization":
f"Bearer {os.environ['PARTNER_API_TOKEN']}"},
)
If you prefer not to hardcode in the WSGI file, store it in a .env file in your home directory and load it.
# /home/yourusername/.env
HTTPS_PROXY=https://user:pass@eu-01.outboundgateway.com:8443
# In your WSGI file, load it:
from dotenv import load_dotenv
load_dotenv("/home/yourusername/.env")
Two IPs, automatic failover
Your account comes with two static IP addresses (for example 51.xx.xx.10 and 51.xx.xx.11). Whitelist both on your partner API. If one proxy node is briefly unavailable, traffic shifts to the other.
📖 Complete Documentation: For detailed examples, error handling, and other Python libraries, see the Python SSL Proxy Guide and all other language guides.
Two addresses to whitelist, with automatic failover. No rotating shared pool to chase.
Set HTTPS_PROXY in your WSGI file and your existing requests, httpx, and urllib3 calls work as-is.
European data centres and a GDPR-conscious setup, giving your app a predictable EU address.
Free, Hacker, Web Dev, or Custom. The proxy is just an env var, so it works regardless of your PythonAnywhere tier.
TLS passthrough means the proxy can't read your traffic. API keys and payloads stay private.
Starting from €19/month. Flexible plans for every scale. Cancel anytime.
Stop letting dynamic IPs break your partner API integrations. Set one env var and your outbound calls route through two fixed EU IPs.
€19/month starter plan • 7-day refund policy • Direct founder support
No. PythonAnywhere runs your app on shared cloud infrastructure, so the outbound IP depends on which server the load balancer assigns. They don't offer a fixed outbound IP on any plan. OutboundGateway fills the gap: set HTTPS_PROXY in your WSGI file and your app gets two fixed EU IPs.
Add os.environ["HTTPS_PROXY"] = "https://user:pass@eu-01.outboundgateway.com:8443" at the top of your WSGI file (found at /var/www/yourusername_pythonanywhere_com_wsgi.py). Or store it in a .env file in your home directory and load it with python-dotenv. Either way, Python's requests library picks it up automatically.
Yes. The proxy works at the Python library level, not the framework level. Whether you run Django, Flask, web2py, Bottle, or any other Python framework on PythonAnywhere, as long as your outbound HTTP calls use requests, httpx, or urllib3, they will route through the proxy automatically.
Happy to talk through how a two-IP EU egress fits your PythonAnywhere project.
Contact Our Founders →