
A proxy username sets the country and the city by carrying both as parameters on the same login string. The host and the port stay fixed. You change the exit by editing the username, and the next request leaves from an address in the place you named.
What the country parameter changes
The country parameter picks the national network the exit address belongs to. A username that ends in a country code asks the gateway for an address registered in that country. The site then records that address, and a geo lookup on it returns the country you set.
The code is short and it is part of the login, not a header you add later. us is the United States and de is Germany. The gateway reads it while it checks the password, so a code placed after the host never arrives. A catalog page priced for shoppers in Germany and the same page priced for shoppers in the United States are two different exits, and they come from two different usernames on one host.
What the city parameter adds
The city parameter narrows that country exit to one city. You append it after the country, and the gateway looks for an address whose registration names that city. A price check for one store needs the country. A check against a city-level promotion needs the city too, because the national exit can land in any city that pool covers.
City coverage is a shorter list than the country list. A country code the dashboard offers can still have no exit in the city you typed, and the gateway then has nothing to assign. When the job needs a mobile network exit rather than a household one, the city list is shorter again, which is covered in which exit a mobile plan uses instead.
What each segment of the username sets
Each segment of the username sets one thing, and the gateway reads them in order. The account name comes first. The country follows it. The city follows the country. A session name, when you want the same exit for the whole job, comes last.
| Segment | Example | What it sets |
|---|---|---|
| Account | customer123 | Which balance the traffic draws from |
| Country | country-us | The national network of the exit address |
| City | city-chicago | The city inside that country |
| Session | session-listing42 | The same exit for the rest of this job |
The separator and the parameter names come from the dashboard, not from this table. One provider joins the parts with hyphens, another with underscores, and a third puts the country in a different position. You copy the pattern the dashboard printed and you only swap the values. Inventing country-us on a gateway that expects cc-us sends a username that account system does not have, and the call fails before any page loads.
Check the exit against the city you set
The exit check is one request to an echo service, through the gateway, before any store page. You look the printed address up and read the city it returns. A city that matches the one in the username means the parameter landed. A different city in the right country means the pool had no exit there and handed you a national address instead. Your own office address means the request never reached the gateway.
import os from urllib.parse import quote import requests user = os.environ["PROXY_USER"] # dashboard pattern, country and city filled in password = quote(os.environ["PROXY_PASS"], safe="") host = os.environ["PROXY_HOST"] # host:port from the dashboard proxy = f"http://{user}:{password}@{host}" session = requests.Session() session.trust_env = False session.proxies = {"http": proxy, "https": proxy} print(session.get("https://api.ipify.org", timeout=30).text) print(session.get("https://ipinfo.io/city", timeout=30).text) The first line is the exit address. The second is the city a lookup assigns to it, which is the value you compare with the city in the username. quote keeps a password that contains @ or : from splitting the URL, so the gateway still sees the username whole. trust_env = False stops an HTTPS_PROXY value in the shell from replacing the string you built. Both dict keys carry the same string, because the library picks the key from the target URL. A missing https key sends the echo out from your own address, and the city you read back is the office one.
You run that echo again after any edit to the username. Changing city-chicago to city-houston does nothing for a session that already has an exit. The new city arrives on the next session, so the session name changes at the same time as the city or the check keeps reporting the old one.
Where the gateway string comes from
The host, the port, the username pattern, and the password come from the provider dashboard, already paired. IPOasis lists dynamic residential proxies from $0.78 per GB, and unused gigabytes stay on the balance. You set the country and the city in that username, and a sticky session holds the exit you were given for up to 120 minutes. When that window ends, the next request can leave from a different address in the same place. You copy the pattern, fill in the country and the city, run the echo once, and only then open the store you actually need.
FAQ
Where does the country go in a proxy username?
The country goes inside the username, as a parameter the dashboard defines. The host and the port stay the same for every country on that account. A country code written after the host is just text in the wrong field, and the gateway never reads it.
Why did the exit come back in the right country but the wrong city?
The pool had no address registered in the city you named, so the gateway assigned one from the rest of that country. The city list is shorter than the country list. You read the cities that dashboard offers for the country and you use one of those spellings.
Does the city name need a region code as well?
That depends on the pattern the dashboard printed. Some accounts take the country and the city alone. Others add a state parameter between them, and a city without it comes back as a login the gateway does not recognize. You copy the full pattern and you fill every segment it shows.
Why did changing the city leave the exit where it was?
The session already held an exit from the earlier username. A city edit reaches the gateway on the next session, so the session name changes in the same edit. Keeping the old session name keeps the old exit for the rest of its window.
What does the echo check prove?
The echo check proves the username was accepted and shows the city of the address you were given. A printed city that matches the username means the parameter landed. Your own office address on that same call means the request never reached the gateway, which comes from a missing https key or a proxy variable still set in the shell.
