Connect through a proxy
Use a returned proxy URL safely with cURL or Python.
Connect without changing the returned URL
The response may include proxy_url, protocol-specific connection strings, a
recommended DNS connection string, and an IP connection string when available.
Use proxy_url unless the application requires a specific returned protocol.
connection_strings_by_protocol groups every supported connection string by
protocol. Each protocol can expose a recommended proxy_url plus DNS- and
IP-based alternatives. Use only entries returned by the API; availability can
differ by proxy type and location.
{
"proxy_url": "http://<username>:<password>@<host>:<port>",
"connection_strings_by_protocol": {
"http": {
"proxy_url": "http://<username>:<password>@<host>:<port>",
"dns": "http://<username>:<password>@<host>:<port>",
"ip": "http://<username>:<password>@<ip-address>:<port>"
}
}
}Treat every returned connection string as a secret. Prefer the recommended
proxy_url; use a DNS or IP alternative only when the client or network setup
requires it.
Choose a protocol response
Read protocols from the options endpoint before requesting a connection.
| Option | Behaviour |
|---|---|
protocol: http | Requests an HTTP proxy connection string. |
protocol: https | Requests an HTTPS proxy connection string when the selected product offers it. |
protocol: socks5 | Requests a SOCKS5 connection string when the selected product offers it. |
protocol_selection: all | Returns every currently available protocol connection string. |
protocol_selection: http_https | Limits returned alternatives to HTTP and HTTPS. |
protocol_selection: socks5 | Limits returned alternatives to SOCKS5. |
Use protocol when the client needs one specific connection. Use
protocol_selection when the application can choose among multiple returned
connection strings. Send only options listed for the selected proxy type.
import os
import requests
proxy_url = os.environ["RASPBYTES_PROXY_URL"]
response = requests.get(
"https://ipinfo.io/json",
proxies={"http": proxy_url, "https": proxy_url},
timeout=30,
)
response.raise_for_status()
print(response.json())Do not log the URL because it contains connection credentials. If a client
returns 407, verify that it supports the returned protocol and receives the
complete URL unchanged.
Updated 16 days ago

