Emailtry

Emailtry

Free verified public proxies · HTTP, HTTPS, SOCKS4, SOCKS4a, SOCKS5

Using a proxy with Python requests and curl

Updated 2026-11-30 · 4 min read

Once you have copied an IP:port and protocol from the live list, the most repeatable way to use it is in curl or in a short Python script. This guide focuses on those two clients, using the same protocol meanings as the rest of the site. For browser and OS dialogs, see how to use a proxy. For a first manual check, see how to test a proxy with curl.

Replace IP and PORT with a single address. Do not loop over the HTML page — ProxyChk does not provide a bulk download or API, and hammering public exits is a good way to get blocked and a bad way to treat other people’s machines. Read the risks before you send anything that is not a throwaway request.

curl: HTTP and HTTPS rows

HTTP and HTTPS rows on this site are both HTTP-style proxies. The proxy URL scheme is http://, even when the column says HTTPS.

# HTTP destination through an HTTP proxy
curl -sS -m 20 -x http://IP:PORT http://example.com/

# HTTPS destination (CONNECT) through the same kind of proxy
curl -sS -m 20 -x http://IP:PORT https://example.com/

Equivalent long option: --proxy http://IP:PORT.

Useful extras:

Environment variables, if you want a whole shell session to go through one HTTP proxy:

export http_proxy=http://IP:PORT
export https_proxy=http://IP:PORT
export no_proxy=localhost,127.0.0.1
curl -sS -m 20 https://ifconfig.me

https_proxy still points at http://IP:PORT. That is intentional: curl will use CONNECT for HTTPS sites. Unset the variables when you are done (unset http_proxy https_proxy).

curl: SOCKS rows

# SOCKS5, remote DNS (preferred)
curl -sS -m 20 -x socks5h://IP:PORT https://ifconfig.me

# SOCKS5, local DNS
curl -sS -m 20 -x socks5://IP:PORT https://ifconfig.me

# SOCKS4 (IPv4, local DNS)
curl -sS -m 20 -x socks4://IP:PORT https://ifconfig.me

# SOCKS4a (hostname sent to the proxy)
curl -sS -m 20 -x socks4a://IP:PORT https://ifconfig.me

Flags --socks5-hostname, --socks5, --socks4 and --socks4a do the same thing. Match the variant to the column on the list. For a session-wide default, export ALL_PROXY=socks5h://IP:PORT is the usual pattern.

Python: requests with HTTP or CONNECT

The standard pattern is a proxies dict. The keys are destination schemes; the values are the proxy URL:

import requests

proxies = {
    "http": "http://IP:PORT",
    "https": "http://IP:PORT",
}

r = requests.get(
    "https://ifconfig.me",
    proxies=proxies,
    timeout=20,
)
print(r.text)

Again, both values use http:// as the proxy scheme. requests will issue CONNECT for the https:// destination.

You can also set HTTP_PROXY and HTTPS_PROXY in the environment; requests honours them unless you pass proxies={} to disable. That is a frequent source of confusion in CI machines.

Always pass timeout. Without it, a dead exit can stall a worker forever.

Python: SOCKS with requests

SOCKS support is not in the core requests wheel. Install a SOCKS extra, typically:

pip install "requests[socks]"

That pulls in PySocks. Then:

import requests

proxies = {
    "http": "socks5h://IP:PORT",
    "https": "socks5h://IP:PORT",
}

r = requests.get("https://ifconfig.me", proxies=proxies, timeout=20)
print(r.text)

Use socks5h:// for remote DNS, socks5:// for local DNS, socks4:// for a SOCKS4 row, and socks4a:// when you want SOCKS4a. If you see Missing dependencies for SOCKS support, the extra is not installed in that interpreter.

Alternatively, httpx with a SOCKS transport, or using curl from a subprocess, can be simpler in some deployments. The protocol label on the list still has to match.

Timeouts, retries and identity

Public-list exits are unstable. A reasonable script:

If you need many countries, open the country index and pick live rows by hand for the countries you actually need. Do not scrape the pages for automation. The anonymity column is worth consulting if your destination seeing your real IP would be a problem, remembering that HTTPS and SOCKS elite labels are often a consequence of the tunnel.

Common errors

Example that fails closed if the exit is not the one you expect is hard to write correctly, because some proxies present a pool IP different from the listed address. Checking that the response is not your known home IP is often the practical test.

Related pages