import requests
# HOST, PORT, USERNAME, PASSWORD come with your order (dashboard or API)
proxy = "http://USERNAME:PASSWORD@HOST:PORT"
proxies = {
"http": proxy,
"https": proxy,
}
response = requests.get(
"https://example.com/",
proxies=proxies,
)
print(response.status_code)
# pip install proxyjam
import requests
from proxyjam import ProxyJamClient
with ProxyJamClient(api_key="pj_live_...") as pj:
order = pj.orders.get("ord_...")
proxy = (
f"http://{order.proxy_username}:{order.proxy_password}"
f"@{order.proxy_host}:{order.proxy_port}"
)
response = requests.get(
"https://example.com/",
proxies={"http": proxy, "https": proxy},
)
print(response.status_code)
import axios from "axios";
import { HttpsProxyAgent } from "https-proxy-agent";
// HOST, PORT, USERNAME, PASSWORD come with your order (dashboard or API)
const proxy = "http://USERNAME:PASSWORD@HOST:PORT";
const agent = new HttpsProxyAgent(proxy);
const response = await axios.get(
"https://example.com/",
{
httpAgent: agent,
httpsAgent: agent,
},
);
console.log(response.status);
# HOST, PORT, USERNAME, PASSWORD come with your order (dashboard or API)
curl -x http://USERNAME:PASSWORD@HOST:PORT \
https://example.com/
import java.net.*;
import java.net.http.*;
// HOST, PORT, USERNAME, PASSWORD come with your order (dashboard or API).
// Java switches Basic auth off inside HTTPS tunnels; run it with
// -Djdk.http.auth.tunneling.disabledSchemes=""
var client = HttpClient.newBuilder()
.proxy(ProxySelector.of(
new InetSocketAddress("HOST", Integer.parseInt("PORT"))))
.authenticator(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
"USERNAME", "PASSWORD".toCharArray());
}
})
.build();
var request = HttpRequest.newBuilder()
.uri(URI.create("https://example.com/"))
.build();
var response = client.send(
request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
package main
import (
"fmt"
"net/http"
"net/url"
)
func main() {
// HOST, PORT, USERNAME, PASSWORD come with your order (dashboard or API)
proxy, _ := url.Parse(
"http://USERNAME:PASSWORD@HOST:PORT")
client := &http.Client{Transport: &http.Transport{
Proxy: http.ProxyURL(proxy),
}}
res, _ := client.Get("https://example.com/")
fmt.Println(res.Status)
}