Proxy Country allows you to specify the geographic location from which your scraping requests originate. This feature enables access to geo-restricted content, region-specific pricing, and localized search results by routing your requests through residential IP addresses in your chosen country.Many websites serve different content based on the visitor’s location. Proxy Country addresses this challenge by allowing your requests to appear to originate from any of 190+ supported countries, thereby providing access to region-specific data that would otherwise be unavailable.
When you specify a country code with the proxy_country parameter, ZenRows routes your request through a residential IP address located in that country. The target website recognizes your request as coming from a real user in the specified location, enabling you to access geo-restricted content and view localized results.Proxy Country requires Premium Proxy to be enabled, as only residential IP addresses can provide accurate geolocation. Datacenter proxies cannot reliably represent specific geographic locations.
countries = ['us', 'gb', 'de', 'fr', 'jp']product_url = 'https://example-store.com/product/123'for country in countries: response = requests.get('https://api.zenrows.com/v1/', params={ 'url': product_url, 'apikey': 'YOUR_ZENROWS_API_KEY', 'premium_proxy': 'true', 'proxy_country': country, }) # Extract and compare prices for each region print(f"Price in {country}: {extract_price(response.text)}")
Some websites serve different HTML structures by region:
Python
Copy
Ask AI
def extract_data_by_region(html_content, country): if country in ['us', 'ca']: # North American layout return extract_with_us_selectors(html_content) elif country in ['gb', 'de', 'fr']: # European layout return extract_with_eu_selectors(html_content) else: # Default extraction return extract_with_default_selectors(html_content)
When content remains blocked despite using Proxy Country:
1
Try multiple countries in the same region
Python
Copy
Ask AI
eu_countries = ['de', 'fr', 'it', 'es', 'nl']for country in eu_countries: # Test each country
2
Check if the entire region is blocked
Python
Copy
Ask AI
test_countries = ['us', 'gb', 'de', 'jp', 'au', 'br']# Test diverse geographic locations
3
Combine with additional features
js_render: Makes the request act like a headles browser
wait_for: Waits for a specific CSS element on the target url
custom_headers: Enable using custom headers on the request
Python
Copy
Ask AI
params = { 'premium_proxy': 'true', 'proxy_country': 'us', 'js_render': 'true', # For JavaScript-heavy sites 'wait_for': '.content', # Wait for specific elements 'custom_headers': 'true', # Enable using custom headers on the request}headers = { 'referer': 'https://www.google.com'}
No, Proxy Country requires Premium Proxy to be enabled. Only residential IP addresses can provide accurate geolocation, and Premium Proxy is necessary to access residential IPs.
How accurate is the geolocation?
ZenRows utilizes genuine residential IP addresses from ISPs in each country, ensuring highly accurate geolocation that websites recognize as legitimate traffic from those specific regions.
Can I specify a city or state within a country?
Currently, ZenRows supports country-level geolocation only. You cannot specify specific cities or states within a country.
What happens if a country is unavailable?
If no residential IPs are available for your specified country, the request will fail. Implement fallback logic to try alternative countries in such cases.
Do different countries have different success rates?
Yes, success rates can vary by country depending on the target website’s blocking policies and the quality of residential IP pools in each region. Monitor your success rates and adjust accordingly.
Can I use the same country for all requests in a session?
Yes, you can use the same country consistently. However, some websites may still detect patterns, so consider rotating between countries in the same region if needed.