proxys.app

Dedicated Brazilian mobile proxy, unlimited bandwidth, instant card/Google Pay activation.

Product

  • About us
  • Plans
  • How it works
  • Use cases
  • Blog
  • Integration
  • Partners

Support

  • Help center
  • Telegram
  • suporte@proxys.app

Legal

  • Terms of Use
  • Privacy Policy
  • Cookie Policy
  • Refund Policy

© 2026 proxys.app — All rights reserved.

proxys.app is operated by 43.029.042 TAUA ALENCASTRO DE CARVALHO

CNPJ (Brazilian company ID) 43.029.042/0001-68

Versão em português

proxys.app
HomePlansUse casesBlogMy IP
Log inCreate account
Back to blog

QA & Automation · November 26, 2026 · 6 min read · Ler em português

How to use a proxy in Python with requests

How to set up HTTP and SOCKS5 proxies with authentication in Python's requests library, check the exit IP, handle errors and rotate the Mobile Proxy IP from the script itself.

The requests library is the most common way to make HTTP calls in Python, and setting a proxy in it takes one line. This guide shows how to use the Mobile Proxy over HTTP and SOCKS5, how to check the exit IP and how to rotate the IP from inside the script.

HTTP proxy with username and password

requests takes a proxies dictionary with one entry for HTTP and one for HTTPS. Both point to the same proxy, in the format http://username:password@host:port. In practice: proxies = {"http": url, "https": url}, then requests.get(address, proxies=proxies, timeout=30).

The "https" entry still starts with http://. It says which proxy to use for HTTPS sites; the proxy protocol itself is HTTP, and traffic to the site stays encrypted inside the tunnel.

SOCKS5 proxy

For SOCKS5, install support with pip install requests[socks] and change the URL prefix to socks5h://username:password@host:port. Use socks5h, with the h: that way DNS resolution also goes through the proxy. With plain socks5, DNS is resolved on your machine, which can reveal your location and return different results from what a Brazilian user would see.

Checking the exit IP

Before running the real task, call a service that returns your IP, such as the panel's current IP endpoint or any "what is my IP" service. The IP should belong to a Brazilian mobile carrier. If you get your server's IP, the proxies dictionary wasn't passed to the call.

Timeouts and errors

  • Always pass a timeout. Without one, a stuck connection can hang the script indefinitely.
  • Error 407 means authentication was refused: check username and password. If the password has special characters, URL-encode them.
  • Occasional connection errors may be the IP rotation. Retry after a short wait of 5 to 10 seconds.

Rotating the IP from the script

On the Monthly plan, the panel shows an IP rotation link. A GET call to that link rotates the proxy IP, no login needed, and the rotation takes a few seconds to apply. The limit is one rotation per minute per proxy; asking sooner returns error 429. A common flow: call the link, wait about 10 seconds, check the new IP and continue the task.

To keep a session (cookies, login) across calls, use requests.Session() with the proxies set once on the session, and avoid rotating the IP in the middle of a sequence that depends on login.

Ready to run on a dedicated Mobile Proxy?

View plans

Related articles

  • How to use a proxy in Selenium (Chrome and Firefox)
  • Proxy in Playwright and Puppeteer: setup and authentication
  • How to use a proxy in n8n
  • Proxy in Baileys and WPPConnect

We use essential cookies for the site to function, and analytics cookies to understand platform usage. See our Cookie Policy.