Skip to content
intermediate

Use ChangeMyIP Residential Proxies with cURL and Python on Linux

A practical Linux guide to sending HTTP and SOCKS5 traffic through ChangeMyIP residential proxies with cURL and Python Requests.

Linux SOCKS5 HTTP(S) Web Scraping

Overview

This tutorial shows how to use ChangeMyIP residential proxies from Linux command-line tools and Python scripts. ChangeMyIP provides residential and datacenter proxies, rotating IPs, and multiple protocols, including HTTP and SOCKS5. You will need your ChangeMyIP proxy host, port, username, and password. The examples use environment variables so credentials are not hard-coded into scripts.

Steps

  1. Log in to ChangeMyIP and select a residential proxy endpoint. Note the host, port, username, and password.
  2. Open a terminal and export your credentials: export CMY_HOST=your-host export CMY_PORT=your-port export CMY_USER=your-username export CMY_PASS=your-password
  3. Test an HTTP proxy with cURL: curl -x http://$CMY_USER:$CMY_PASS@$CMY_HOST:$CMY_PORT https://ifconfig.me
  4. Test a SOCKS5 proxy with cURL: curl --socks5-hostname $CMY_USER:$CMY_PASS@$CMY_HOST:$CMY_PORT https://ifconfig.me
  5. For Python, install Requests and the SOCKS dependency: pip install requests requests[socks]
  6. Create a Python script that reads the environment variables and sends a request through the HTTP proxy: proxies = {'http': f'http://{user}:{password}@{host}:{port}', 'https': f'http://{user}:{password}@{host}:{port}'} requests.get('https://ifconfig.me', proxies=proxies, timeout=30)
  7. For SOCKS5 in Python, use the same credentials with a socks5h:// proxy URL.
  8. If your ChangeMyIP plan provides rotating IPs, use the rotating endpoint from your account to change the exit IP automatically. Otherwise, switch between fixed endpoints.
  9. Add retries and timeouts to handle proxy errors, and rotate user agents only when it is appropriate for your use case.
  10. Verify each response by checking the returned IP and country. This confirms that traffic is leaving through ChangeMyIP.