# Proxy Format: IP:Port:User:Pass

> How to use a proxy with username and password, and test it with cURL, Python and Node.

## Proxy format example

Proxies are written in two formats. Both hold the same four parts: the IP (or host), the port, the username and the password.

```
ip:port:user:pass          203.0.113.7:20000:user:pass
user:pass@ip:port          user:pass@203.0.113.7:20000
```

Bots and proxy lists take the first. Code and command lines take the second, with http:// in front.

## How to use a proxy with username and password

Put the username and password in the proxy's address: http://user:pass@ip:port. Every Enfra line carries its own username and password, so there is nothing else to switch on.

## How to test a proxy with cURL

Put the proxy after -x. This prints the IP the site sees: your proxy's, not your own.

```
curl -x http://user:pass@203.0.113.7:20000 https://api.ipify.org
```

## cURL proxy authentication

The username and password can also go in their own option, -U (--proxy-user):

```
curl -x http://203.0.113.7:20000 -U user:pass https://api.ipify.org
```

## Python requests proxy authentication

```
import requests

proxy = "http://user:pass@203.0.113.7:20000"
r = requests.get("https://api.ipify.org", proxies={"http": proxy, "https": proxy})
print(r.text)
```

## Node fetch proxy

```
import { fetch, ProxyAgent } from "undici";

const proxy = new ProxyAgent("http://user:pass@203.0.113.7:20000");
const r = await fetch("https://api.ipify.org", { dispatcher: proxy });
console.log(await r.text());
```

## 407 Proxy Authentication Required

The proxy did not get the right username and password. Check the line is pasted whole, in the format your tool expects, with no space at either end.

## Questions

### What is a proxy username and password?

The login that proves the proxy is yours. They are the last two parts of every line: ip:port:user:pass.

### What is proxy IP and port?

The IP is the proxy's address and the port is the door on it. Ours are the first two parts of every line, for example 203.0.113.7 and 20000.

### How to test if your proxy is working?

Run the cURL line above. If it prints the proxy's IP, it works.

Source: https://www.enfralabs.com/docs/proxy-format
