With Requests available in your project, pass a proxy mapping to the call:

import requests

proxies = {
    "http": "http://127.0.0.1:8080",
    "https": "http://127.0.0.1:8080",
}

response = requests.get(
    "https://example.com/",
    proxies=proxies,
    timeout=(5, 15),
)
response.raise_for_status()
print(response.status_code)

Replace the loopback endpoint with your running proxy or a candidate from the HTTP proxy list that you will test with this request. The keys describe destination schemes: http for HTTP URLs and https for HTTPS URLs. The values describe the proxy listener. They may be different endpoints if your network requires separate routes.

An http:// proxy value under the https key is intentional. Requests asks the HTTP listener for a CONNECT tunnel and then establishes destination TLS through it, subject to the proxy's destination and port policy. Changing the value to https:// asks for TLS to the proxy itself; it can fail if the listener expects cleartext HTTP.

What the two timeout numbers mean

timeout=(5, 15) sets connection and read timeouts. It does not impose a fifteen-second total deadline. Periodic incoming data, multiple addresses and connection attempts can extend elapsed time. Requests supplies no general timeout when you omit the setting, so choose limits appropriate to the response and add an application-level deadline if the job needs a strict overall budget.

Handle the failure at the stage where it occurs

try:
    response = requests.get(
        "https://example.com/",
        proxies=proxies,
        timeout=(5, 15),
    )
    response.raise_for_status()
except requests.exceptions.ProxyError as error:
    print("Proxy setup failed:", type(error).__name__)
except requests.exceptions.Timeout:
    print("A configured timeout expired")
except requests.exceptions.HTTPError as error:
    print("HTTP status:", error.response.status_code)

A rejected CONNECT can raise ProxyError before a destination response exists. The HTTPError branch follows a received response with an error status; Timeout means a configured limit expired. Inspect setup exception chains locally, removing credential-bearing endpoints and private URLs before sharing them.

Leave certificate verification enabled. If the authorized network uses a private CA or managed interception, supply the expected trust material rather than disabling verification.

Explicit per-request entries control the routes supplied here, but omitted schemes can still be affected by environment proxy discovery. When moving the call into a reusable Session, decide how environment variables, Session defaults and per-request overrides should interact; connection reuse and routing policy are separate choices.

Artihkkalat mat laktásit