Proxy formats: host:port:user:pass and friends

Four pieces of information, half a dozen ways of writing them. Most "my proxy does not work" tickets are a format mix-up.

See plans from $75/mo ♡ Read the docs

The four parts

Common layouts

host:port:username:password        colon format (how we deliver)
username:password@host:port        URL-style without scheme
socks5://username:password@host:port   full URL
host:port@username:password        used by a few bulk tools

Converting

Split the colon format at each colon: first piece is the host, second the port, third the username, fourth the password. To build a URL, write scheme, then username, colon, password, an at-sign, host, colon, port.

import sys
host, port, user, pw = sys.argv[1].split(':', 3)
print(f'socks5://{user}:{pw}@{host}:{port}')

Questions

My password contains a colon.

Split on the first three colons only, as the snippet does, so the remainder stays intact.

Which scheme do I write?

socks5:// or socks5h:// for SOCKS lines, http:// for HTTP proxies.

Related guides

Ready for your own dedicated private mobile proxy? 🎀

Real AT&T, Verizon and T-Mobile SIMs · unlimited data · one-tap IP rotation · delivered by email or Telegram.