Proxy documentation

Usage examples

Practical examples demonstrating how to use the proxy product with different options. This includes sample commands and scripts using popular tools like cURL.


# ==============================================
# Proxy Test Script using Python + requests
# ==============================================
# This script sends a request through an authenticated HTTPS proxy
# Useful for testing proxy rotation, headers, location, etc.
# Dependencies: Python 3.12, "requests" package
# 💡 SETUP INSTRUCTIONS:
# 1. Create a virtual environment (recommended):
#      python3 -m venv venv
# 2. Activate the virtual environment:
#      source venv/bin/activate
# 3. Install the required package:
#      pip3 install requests
# 4. Run the script:
#      python3 your_script.py
# ==============================================

import requests  # External library to perform HTTP requests easily

# Proxy credentials and endpoint configuration
proxy_user = "customer-<proxy_user_name>-cc-xx-rg-zz-city-yyyy-sessid-abcde12345"
proxy_pass = "PASSWORD"
proxy_host = "rs.magneticproxy.net"
proxy_port = "443"

# Construct proxy URL with basic auth
proxy_url = f"https://{proxy_user}:{proxy_pass}@{proxy_host}:{proxy_port}"

# Define both HTTP and HTTPS proxies
proxies = {
    "http": proxy_url,
    "https": proxy_url
}

# Try to make a GET request through the proxy
try:
    response = requests.get("https://google.com", proxies=proxies, timeout=10)

    # If successful, print the response status and body
    print("Status code:", response.status_code)
    print("Body:", response.text)

except Exception as e:
    # If something goes wrong, print full traceback
    print("[ERROR] Request failed")
    import traceback
    traceback.print_exc()

Python Variables

Host and port should be kept as are rs.magneticproxy.net and 80/1080, respectively. Then, you only need to update proxy_user and proxy_pass values.

ParameterDescriptionDefault ValueExample

proxy_user

Sets the user credentials for proxy access. Provided when a plan is purchased. In the username section custom options can be added. See Proxy Options.

None (mandatory)

customer-USERNAME

proxy_pass

Password for proxy authentication.

None (mandatory)

PASSWORD

proxy_host

Specifies the proxy server to use.

rs.magneticproxy.net

rs.magneticproxy.net

proxy_port

Proxy port.

1080 (HTTP), 80 (HTTP), 443 (HTTPS)

80

Supported Proxy Protocols

MagneticProxy supports HTTP/HTTPS/SOCKS5 protocols:

ProtocolDescription

http / https

Standard HTTP/HTTPS proxying. Suitable for web traffic and tools like browsers or cURL.

socks5

SOCKS version 5 with client-side DNS resolution (the client resolves the destination IP).

socks5h

SOCKS version 5 with proxy-side DNS resolution (the proxy resolves the destination domain). The h in socks5h stands for “hostname resolution on the proxy.

Prefer socks5h if you want to hide the destination domain from the client network, if the proxy needs to resolve private or internal domains, or if you’re operating behind firewalls or VPNs where local DNS resolution may fail.

Proxy Endpoint Format

Use the following format to specify your proxy connection: <protocol>://<host>:<port>

ProtocolHostPort(s)Full URL

HTTP

rs.magneticproxy.net

1080/80

http://rs.magneticproxy.net:1080

HTTPS

rs.magneticproxy.net

443

https://rs.magneticproxy.net:443

SOCKS5

rs.magneticproxy.net

9000

socks5://rs.magneticproxy.net:9000

SOCKS5h

rs.magneticproxy.net

9000

socks5h://rs.magneticproxy.net:9000

Options

Detailed explanation of the available proxy options, including their purpose and functionality. They are included in the username separated by - (hyphens) between the key and the value, and also between each key-value pair.

ParameterDescriptionDefault ValueExample

customer

Customer Username for proxy authentication. Will be provided by email once a subscription is done.

None (mandatory)

customer-MyUserName

cc

Country code of standard ISO 3166-1 alpha-2 for proxy location. If not specified, a proxy from any location will be used. Case insensitive.

N/A

cc-us

rg

Region/state/province name for proxy location. No ISO standard, just the name. If not specified, a proxy from any location will be used. Case insensitive.

N/A

rg-florida

city

City name for proxy location. No ISO standard, just the name. If not specified, a proxy from any location will be used. Case insensitive.

N/A

city-miami

sessid

Session identifier for proxy. AKA Sticky session ID. Alphanumeric that must be generated by the client and always be the same for the sticky session. Do not use hyphens when creating this identifier. When sessid is present, the same proxy IP will be maintained between all requests if possible. If the IP is not available, another from the same country will be provided. If there are no more IPs from that country, an IP from any country will be provided.

N/A

sessid-abcde12345

sesstime

Session duration for proxy authentication. If not specified, a default of 30 minutes will be used. Session time value is in seconds.

1800 (30 minutes)

sesstime-60

hardcountry

Operates in tandem with sessid. When enabled, in the event that the session ID's linked proxy isn't located, and no proxy from the same country is located either, it results in failure.

false

hardcountry-true

Restricted targets

Some websites are limited or blocked on our Residential Proxy network to avoid misuse and suspicious activities. The list includes but is not limited to:

CategoryExamplesRestrictions / Notes

Social Media

LinkedIn, Instagram, Facebook, X.com

Access is fully blocked; the proxy will return an error.

Government & Public

usa.gov, canada.ca, *.gov domains

Official or sensitive sites; usage is restricted.

Email Providers

Outlook, Yahoo Mail

Access is fully blocked; the proxy will return an error.

SOCKS Proxy

Port 25

Port 25 is closed by default.

If you have any question, get in touch with our customer support team at contact@magneticproxy.com or via the 24/7 live chat on our website.

Get rotating residential proxies
from real devices.