Geographic Location

Certain websites (typically e-commerce stores and search engines) display different data to different users based on the geolocation of the IP used to make the request to the website. In cases like these, you can use the API’s geotargeting functionality to easily use proxies from the required country to retrieve the correct data from the website.

To control the geolocation of the IP used to make the request, simply set the country_code parameter to the country you want the proxy to be from and the API will automatically use the correct IP for that request.

For example: to ensure your requests come from the United States, set the country_code parameter to country_code=us.

Business and Enterprise Plan users can geotarget their requests to the following 13 countries (Hobby and Startup Plans can only use US and EU geotargeting) by using the country_code in their request:

Country CodeCountryPlans

us

United States

Hobby Plan and higher.

eu

Europe (general)

Hobby Plan and higher.

au

Australia

Business Plan and higher.

ae

United Arab Emirates

Business Plan and higher.

ar

Argentina

Business Plan and higher.

at

Austria

Business Plan and higher.

bd

Bangladesh

Business Plan and higher.

be

Belgium

Business Plan and higher.

br

Brazil

Business Plan and higher.

ca

Canada

Business Plan and higher.

ch

Switzerland

Business Plan and higher.

cl

Chile

Business Plan and higher.

cn

China

Business Plan and higher.

de

Germany

Business Plan and higher.

dk

Denmark

Business Plan and higher.

eg

Egypt

Business Plan and higher.

es

Spain

Business Plan and higher.

fi

Finland

Business Plan and higher.

fr

France

Business Plan and higher.

gr

Greece

Business Plan and higher.

hk

Hong Kong

Business Plan and higher.

hu

Hungary

Business Plan and higher.

id

Indonesia

Business Plan and higher.

ie

Ireland

Business Plan and higher.

il

Israel

Business Plan and higher.

in

India

Business Plan and higher.

it

Italy

Business Plan and higher.

jo

Jordan

Business Plan and higher.

jp

Japan

Business Plan and higher.

ke

Kenya

Business Plan and higher.

kr

South Korea

Business Plan and higher.

mx

Mexico

Business Plan and higher.

my

Malaysia

Business Plan and higher.

ng

Nigeria

Business Plan and higher.

nl

Netherlands

Business Plan and higher.

no

Norway

Business Plan and higher.

nz

New Zealand

Business Plan and higher.

pe

Peru

Business Plan and higher.

ph

Phillipines

Business Plan and higher.

pk

Pakistan

Business Plan and higher.

pl

Poland

Business Plan and higher.

pt

Portugal

Business Plan and higher.

ru

Russia

Business Plan and higher.

sa

Saudi Arabia

Business Plan and higher.

se

Sweden

Business Plan and higher.

sg

Singapore

Business Plan and higher.

th

Thailand

Business Plan and higher.

tr

Turkey

Business Plan and higher.

tw

Taiwan

Business Plan and higher.

ua

Ukraine

Business Plan and higher.

uk

United Kingdom

Business Plan and higher.

ve

Venezuela

Business Plan and higher.

vn

Vietnam

Business Plan and higher.

za

South Africa

Business Plan and higher.

bg

Bulgaria

Business Plan and higher.

hr

Croatia

Business Plan and higher.

cy

Cyprus

Business Plan and higher.

cz

Czechia

Business Plan and higher.

ee

Estonia

Business Plan and higher.

is

Iceland

Business Plan and higher.

lv

Latvia

Business Plan and higher.

li

Liechtenstein

Business Plan and higher.

lt

Lithuania

Business Plan and higher.

mt

Malta

Business Plan and higher.

ro

Romania

Business Plan and higher.

sk

Slovakia

Business Plan and higher.

si

Slovenia

Business Plan and higher.

ec

Ecuador

Business Plan and higher.

pa

Panama

Business Plan and higher.

Other countries are available to Enterprise customers upon request.

  • API REQUEST

import requests
payload = {'api_key': 'APIKEY', 'url':'https://httpbin.org/ip', 'country_code': 'us'}
r = requests.get('http://api.scraperapi.com', params=payload)
print(r.text)

# Scrapy users can simply replace the urls in their start_urls and parse function
# ...other scrapy setup code
start_urls = ['http://api.scraperapi.com?api_key=APIKEY&url=' + url + 'country_code=us']

def parse(self, response):
# ...your parsing logic here
yield scrapy.Request('http://api.scraperapi.com/?api_key=APIKEY&url=' + url + 'country_code=us', self.parse)
  • PROXY MODE

import requests
proxies = {
  "http": "http://scraperapi.country_code=us:APIKEY@proxy-server.scraperapi.com:8001"
}
r = requests.get('http://httpbin.org/ip', proxies=proxies, verify=False)
print(r.text)

# Scrapy users can likewise simply pass their API key in headers.
# NB: Scrapy skips SSL verification by default.
# ...other scrapy setup code
start_urls = ['http://httpbin.org/ip']
meta = {
  "proxy": "http://scraperapi.country_code=us:APIKEY@proxy-server.scraperapi.com:8001"
}
def parse(self, response):
# ...your parsing logic here
yield scrapy.Request(url, callback=self.parse, headers=headers, meta=meta)
  • SDK Method

// from scraperapi_sdk import ScraperAPIClient
client = ScraperAPIClient('APIKEY')
result = client.get(url = 'http://httpbin.org/ip', country_code=us).text
print(result)
# Scrapy users can simply replace the urls in their start_urls and parse function
# Note for Scrapy, you should not use DOWNLOAD_DELAY and
# RANDOMIZE_DOWNLOAD_DELAY, these will lower your concurrency and are not
# needed with our API
# ...other scrapy setup code
start_urls =[client.scrapyGet(url = 'http://httpbin.org/ip', country_code=us)]
def parse(self, response):
# ...your parsing logic here
yield scrapy.Request(client.scrapyGet(url = 'http://httpbin.org/ip', country_code=us), self.parse)

Last updated