-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03_browse_residential_locations.py
More file actions
32 lines (24 loc) · 1.05 KB
/
Copy path03_browse_residential_locations.py
File metadata and controls
32 lines (24 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Browse residential targeting locations: countries → regions → cities.
The codes returned here are what you pass to build_residential_username().
Note: codes can contain underscores (e.g. 'baden_wurttemberg'); the proxy
username uses dashes — the builder handles the conversion automatically.
"""
from proxyshard import ProxyshardClient
def main() -> None:
client = ProxyshardClient()
proxy_type = "premium"
countries = client.residential_countries(proxy_type=proxy_type)
print(f"=== Countries ({len(countries)}) — first 10 ===")
for c in countries[:10]:
print(f" {c['code']:6} {c['name']}")
print(f"\n=== Regions for Germany (DE) ===")
regions = client.residential_regions("DE", proxy_type=proxy_type)
for r in regions[:5]:
print(f" {r['code']:25} {r['name']}")
print(f"\n=== Cities in DE / Berlin ===")
cities = client.residential_cities("DE", "berlin", proxy_type=proxy_type)
for city in cities[:5]:
print(f" {city['code']:25} {city['name']}")
if __name__ == "__main__":
main()