Prepare the client
Install Requests with python -m pip install requests. The example prompts for connection details and encodes the credentials before building the proxy URL.
Connection example
Python Requests proxy example
import getpass
from urllib.parse import quote
import requests
server = input("Proxy URL without credentials (http://host:port): ").strip()
username = input("Proxy username: ")
password = getpass.getpass("Proxy password: ")
scheme, address = server.split("://", 1)
credentials = f"{quote(username, safe='')}:{quote(password, safe='')}"
proxy = f"{scheme}://{credentials}@{address}"
with requests.Session() as session:
session.trust_env = False
response = session.get(
"https://example.com/",
proxies={"http": proxy, "https": proxy},
timeout=(10, 30),
allow_redirects=False,
)
response.raise_for_status()
print(response.status_code)
print(response.text[:500])Verify the connection
Start with a public test destination you are allowed to access. Confirm authentication, exit IP and timeouts before adding target-specific parsing. Never disable TLS verification to make a failing connection appear successful.
When it fails
Review Troubleshooting for authentication, DNS, connection and TLS errors. Include your client version and a sanitized error when contacting support.