Use ProxyHQ with Python Requests
Use ProxyHQ with the Requests library.
Connection details
Use these values. Your login and password are in your dashboard.
| Type | HTTP (or SOCKS5) |
| Host | gw.proxyhq.net |
| Port (HTTP / HTTPS) | 823 |
| Port (SOCKS5) | 824 |
| Sticky ports | 10000 - 20000 |
| Username | YOUR_LOGIN |
| Password | YOUR_PASSWORD |
Steps
- Install Requests with pip install requests.
- Build a proxy URL from your login, password, host and port, and pass it for both http and https.
- Always set a timeout so a slow request cannot hang your script.
import requests proxy = "http://YOUR_LOGIN__cr.us:[email protected]:823" proxies = {"http": proxy, "https": proxy} r = requests.get("https://api.ipify.org", proxies=proxies, timeout=30) print(r.text)
import requests proxy = "http://YOUR_LOGIN:[email protected]:10001" # sticky port s = requests.Session() s.proxies = {"http": proxy, "https": proxy} for _ in range(3): print(s.get("https://api.ipify.org", timeout=30).text) # same IP each time
For a sticky session use a port from 10000 to 20000 and reuse a requests.Session object.
For SOCKS5 install requests[socks] and use socks5h:// with port 824.
Choose a country or a sticky IP
Add __cr.de (or another country code) to the end of your login to choose a country. Use a port from 10000 to 20000 for a sticky IP. See country targeting and rotating vs sticky.
Stuck? See troubleshooting or email [email protected].