# Language integrations > Connect to PacketStream with cURL, Python Requests, Node.js Undici, Go net/http, or Playwright using authenticated HTTPS proxy configuration. Use the recommended HTTPS endpoint unless your client specifically requires SOCKS5. The examples read credentials from environment variables and request `ipinfo.io` so you can inspect the observed exit. Set these values before running an example: ```bash export PACKETSTREAM_USER='your_username' export PACKETSTREAM_AUTH_KEY='your_auth_key' ``` Do not commit real credentials to a script, `.env` file, test fixture, or container image. ## cURL ```bash curl --silent --show-error --fail-with-body \ --proxy 'https://proxy.packetstream.io:31111' \ --proxy-user "${PACKETSTREAM_USER}:${PACKETSTREAM_AUTH_KEY}" \ 'https://ipinfo.io' \ | jq '{ip, hostname, city, region, country, loc, org, postal, timezone}' ``` Use `--connect-timeout` and `--max-time` when the command runs unattended. ## Python with Requests Install Requests: ```bash python -m pip install requests ``` ```python import os from urllib.parse import quote import requests username = quote(os.environ["PACKETSTREAM_USER"], safe="") auth_key = quote(os.environ["PACKETSTREAM_AUTH_KEY"], safe="") proxy = f"https://{username}:{auth_key}@proxy.packetstream.io:31111" response = requests.get( "https://ipinfo.io", proxies={"http": proxy, "https": proxy}, timeout=30, ) response.raise_for_status() print(response.json()) ``` Pass the `proxies` dictionary on the request so environment proxy settings cannot unexpectedly replace the intended configuration. See the official [Requests proxy documentation](https://requests.readthedocs.io/en/stable/user/advanced/#proxies). ## Node.js with Undici Install the current Undici package: ```bash npm install undici ``` ```javascript import { ProxyAgent, fetch } from "undici"; const username = process.env.PACKETSTREAM_USER; const authKey = process.env.PACKETSTREAM_AUTH_KEY; if (!username || !authKey) { throw new Error("Set PACKETSTREAM_USER and PACKETSTREAM_AUTH_KEY"); } const token = Buffer.from(`${username}:${authKey}`).toString("base64"); const dispatcher = new ProxyAgent({ uri: "https://proxy.packetstream.io:31111", token: `Basic ${token}`, }); try { const response = await fetch("https://ipinfo.io", { dispatcher, signal: AbortSignal.timeout(30_000), }); if (!response.ok) throw new Error(`HTTP ${response.status}`); console.log(await response.json()); } finally { await dispatcher.close(); } ``` Undici's `ProxyAgent` supports HTTPS proxy URIs and a preformatted proxy-authorization token. See the official [ProxyAgent documentation](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md). ## Go with net/http ```go package main import ( "fmt" "io" "log" "net/http" "net/url" "os" "time" ) func main() { proxyURL := &url.URL{ Scheme: "https", Host: "proxy.packetstream.io:31111", User: url.UserPassword(os.Getenv("PACKETSTREAM_USER"), os.Getenv("PACKETSTREAM_AUTH_KEY")), } transport := http.DefaultTransport.(*http.Transport).Clone() transport.Proxy = http.ProxyURL(proxyURL) client := &http.Client{Transport: transport, Timeout: 30 * time.Second} response, err := client.Get("https://ipinfo.io") if err != nil { log.Fatal(err) } defer response.Body.Close() body, err := io.ReadAll(response.Body) if err != nil { log.Fatal(err) } fmt.Println(string(body)) } ``` Go determines proxy behavior from the URL scheme and passes URL user information as proxy authorization. See the official [`net/http` Transport documentation](https://pkg.go.dev/net/http#Transport). ## Playwright ```javascript import { chromium } from "playwright"; const browser = await chromium.launch({ proxy: { server: "https://proxy.packetstream.io:31111", username: process.env.PACKETSTREAM_USER, password: process.env.PACKETSTREAM_AUTH_KEY, }, }); try { const page = await browser.newPage(); await page.goto("https://ipinfo.io", { waitUntil: "domcontentloaded", timeout: 30_000, }); console.log(JSON.parse(await page.locator("body").innerText())); } finally { await browser.close(); } ``` Browsers reuse connections. A new page or navigation does not guarantee a new proxy connection or exit. See the full [PacketStream Playwright guide](https://packetstream.io/how-to-use-packetstream-residential-proxies-with-playwright/) for targeting, sticky sessions, and browser-specific recovery. ## Apply targeting or a sticky session Every example can change the password value without changing the endpoint: ```text PACKETSTREAM_AUTH_KEY + "_country-US" PACKETSTREAM_AUTH_KEY + "_session-workflow42" PACKETSTREAM_AUTH_KEY + "_country-US_session-workflow42" ``` Keep the composition in application configuration so the final password is not written to logs. For complete runnable projects and Docker configurations, use the [official PacketStream examples repository](https://github.com/packetstream/packetstream-examples).