> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eclipseproxy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scripts (cURL, Python, Node, Go)

> Using EclipseProxy from command-line scripts and HTTP libraries

Working examples for the most common scripting tools. Each section uses `CodeGroup` tabs: your language choice syncs across the page.

## Basic GET request

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl -x http://USER:PASS@HOST:PORT https://api.ipify.org
  ```

  ```python Python theme={"dark"}
  import requests

  proxies = {
      "http": "http://USER:PASS@HOST:PORT",
      "https": "http://USER:PASS@HOST:PORT",
  }

  r = requests.get("https://api.ipify.org", proxies=proxies)
  print(r.text)
  ```

  ```javascript Node theme={"dark"}
  const axios = require('axios');
  const { HttpsProxyAgent } = require('https-proxy-agent');

  const agent = new HttpsProxyAgent('http://USER:PASS@HOST:PORT');

  (async () => {
    const r = await axios.get('https://api.ipify.org', { httpsAgent: agent });
    console.log(r.data);
  })();
  ```

  ```go Go theme={"dark"}
  package main

  import (
      "fmt"
      "io"
      "net/http"
      "net/url"
  )

  func main() {
      proxyURL, _ := url.Parse("http://USER:PASS@HOST:PORT")
      client := &http.Client{
          Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},
      }
      r, _ := client.Get("https://api.ipify.org")
      defer r.Body.Close()
      body, _ := io.ReadAll(r.Body)
      fmt.Println(string(body))
  }
  ```
</CodeGroup>

## SOCKS5

<CodeGroup>
  ```bash cURL theme={"dark"}
  # Either form works
  curl --socks5 USER:PASS@HOST:PORT https://api.ipify.org
  curl -x socks5h://USER:PASS@HOST:PORT https://api.ipify.org   # DNS via proxy
  ```

  ```python Python theme={"dark"}
  # pip install requests[socks]
  import requests

  proxies = {
      "http": "socks5://USER:PASS@HOST:PORT",
      "https": "socks5://USER:PASS@HOST:PORT",
  }
  r = requests.get("https://api.ipify.org", proxies=proxies)
  ```

  ```javascript Node theme={"dark"}
  // npm install axios socks-proxy-agent
  const axios = require('axios');
  const { SocksProxyAgent } = require('socks-proxy-agent');

  const agent = new SocksProxyAgent('socks5://USER:PASS@HOST:PORT');

  (async () => {
    // Pass the agent to BOTH httpAgent and httpsAgent so it proxies either scheme.
    const r = await axios.get('https://api.ipify.org', {
      httpAgent: agent,
      httpsAgent: agent,
    });
    console.log(r.data);
  })();
  ```
</CodeGroup>

## Timing / debugging

<CodeGroup>
  ```bash cURL theme={"dark"}
  # Total request time
  curl -x http://USER:PASS@HOST:PORT -o /dev/null -s -w "%{time_total}\n" https://api.ipify.org

  # Full handshake trace
  curl -x http://USER:PASS@HOST:PORT -v https://api.ipify.org
  ```

  ```python Python theme={"dark"}
  import time, requests

  start = time.perf_counter()
  r = requests.get("https://api.ipify.org", proxies=proxies)
  print(f"{time.perf_counter() - start:.2f}s")
  ```

  ```javascript Node theme={"dark"}
  const start = Date.now();
  (async () => {
    const r = await axios.get('https://api.ipify.org', { httpsAgent: agent });
    console.log(`${Date.now() - start}ms`);
  })();
  ```
</CodeGroup>

## Rotating IPs per request

Force a fresh session ID per call so each request gets a new IP on the sticky port.

<CodeGroup>
  ```python Python theme={"dark"}
  import uuid, requests

  def get_proxy():
      sid = uuid.uuid4().hex[:8]
      return f"http://USER-session-{sid}-lifetime-1:PASS@HOST:STICKY_PORT"

  for _ in range(10):
      r = requests.get("https://api.ipify.org", proxies={"https": get_proxy()})
      print(r.text)  # new IP each time
  ```

  ```javascript Node theme={"dark"}
  const crypto = require('crypto');

  const getProxy = () => {
    const sid = crypto.randomBytes(4).toString('hex');
    return `http://USER-session-${sid}-lifetime-1:PASS@HOST:STICKY_PORT`;
  };

  for (let i = 0; i < 10; i++) {
    const agent = new HttpsProxyAgent(getProxy());
    const r = await axios.get('https://api.ipify.org', { httpsAgent: agent });
    console.log(r.data);
  }
  ```

  ```go Go theme={"dark"}
  package main

  import (
      "crypto/rand"
      "encoding/hex"
      "fmt"
      "io"
      "net/http"
      "net/url"
  )

  func main() {
      for i := 0; i < 10; i++ {
          b := make([]byte, 4)
          rand.Read(b)
          sid := hex.EncodeToString(b)
          proxyURL, _ := url.Parse(fmt.Sprintf("http://USER-session-%s-lifetime-1:PASS@HOST:STICKY_PORT", sid))
          client := &http.Client{
              Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},
          }
          r, _ := client.Get("https://api.ipify.org")
          body, _ := io.ReadAll(r.Body)
          r.Body.Close()
          fmt.Println(string(body))
      }
  }
  ```
</CodeGroup>

## Quick country check

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl -x http://USER:PASS@HOST:PORT https://ipinfo.io
  ```

  ```python Python theme={"dark"}
  r = requests.get("https://ipinfo.io", proxies=proxies)
  print(r.json())  # {country, city, isp, ...}
  ```

  ```javascript Node theme={"dark"}
  const r = await axios.get('https://ipinfo.io', { httpsAgent: agent });
  console.log(r.data);  // {country, city, isp, ...}
  ```
</CodeGroup>

## Other Python clients

<CodeGroup>
  ```python httpx theme={"dark"}
  import httpx
  with httpx.Client(proxies="http://USER:PASS@HOST:PORT") as c:
      print(c.get("https://api.ipify.org").text)
  ```

  ```python aiohttp theme={"dark"}
  import aiohttp, asyncio

  async def main():
      async with aiohttp.ClientSession() as s:
          async with s.get("https://api.ipify.org",
                           proxy="http://USER:PASS@HOST:PORT") as r:
              print(await r.text())

  asyncio.run(main())
  ```
</CodeGroup>

## Common mistakes

* **"Works in cURL but not in my script"**: set BOTH `http` and `https` proxy keys, not just one
* **URL-encoded characters in password**: make sure they're not being decoded twice
* **SOCKS5 in Python requests**: install `requests[socks]`
* **`Tunnel connection failed: 466 Limit Reached`**: hit a bandwidth or thread cap. See [Error codes](/errors/codes#466-deep-dive).

See [Common issues](/errors/common-issues) for diagnosing weirder failures.
