# Seleccionar país

Si quieres acceder a IPs de ubicaciones específicas, debes proporcionar un `país` – parámetro con un código de país de dos letras en tu nombre de usuario. Aquí está la lista de `país` parámetros. Por ejemplo, si quieres usar el parámetro de país de Estados Unidos, añade `country-US`.

Encuentra la lista completa de países compatibles en la tabla a continuación.&#x20;

<details>

<summary>Lista de países compatibles de Datacenter per IP</summary>

<table><thead><tr><th>País</th><th>Código de país</th><th data-hidden></th></tr></thead><tbody><tr><td>Argentina</td><td><code>country-AR</code></td><td></td></tr><tr><td>Australia</td><td><code>country-AU</code></td><td></td></tr><tr><td>Austria</td><td><code>country-AT</code></td><td></td></tr><tr><td>Bélgica</td><td><code>country-BE</code></td><td></td></tr><tr><td>Brasil</td><td><code>country-BR</code></td><td></td></tr><tr><td>Canadá</td><td><code>country-CA</code></td><td></td></tr><tr><td>Chile</td><td><code>country-CL</code></td><td></td></tr><tr><td>China</td><td><code>country-CN</code></td><td></td></tr><tr><td>Colombia</td><td><code>country-CO</code></td><td></td></tr><tr><td>República Checa</td><td><code>country-CZ</code></td><td></td></tr><tr><td>Dinamarca</td><td><code>country-DK</code></td><td></td></tr><tr><td>Francia</td><td><code>country-FR</code></td><td></td></tr><tr><td>Alemania</td><td><code>country-DE</code></td><td></td></tr><tr><td>India</td><td><code>country-IN</code></td><td></td></tr><tr><td>Indonesia</td><td><code>country-ID</code></td><td></td></tr><tr><td>Irlanda</td><td><code>country-IE</code></td><td></td></tr><tr><td>Israel</td><td><code>country-IL</code></td><td></td></tr><tr><td>Italia</td><td><code>country-IT</code></td><td></td></tr><tr><td>Japón</td><td><code>country-JP</code></td><td></td></tr><tr><td>México</td><td><code>country-MX</code></td><td></td></tr><tr><td>Países Bajos</td><td><code>country-NL</code></td><td></td></tr><tr><td>Perú</td><td><code>country-PE</code></td><td></td></tr><tr><td>Polonia</td><td><code>country-PL</code></td><td></td></tr><tr><td>Portugal</td><td><code>country-PT</code></td><td></td></tr><tr><td>Rumanía</td><td><code>country-RO</code></td><td></td></tr><tr><td>Arabia Saudita</td><td><code>country-SA</code></td><td></td></tr><tr><td>Singapur</td><td><code>country-SG</code></td><td></td></tr><tr><td>Eslovaquia</td><td><code>country-SK</code></td><td></td></tr><tr><td>España</td><td><code>country-ES</code></td><td></td></tr><tr><td>Suiza</td><td><code>country-CH</code></td><td></td></tr><tr><td>Tailandia</td><td><code>country-TH</code></td><td></td></tr><tr><td>Emiratos Árabes Unidos</td><td><code>country-AE</code></td><td></td></tr><tr><td>Reino Unido</td><td><code>country-GB</code></td><td></td></tr><tr><td>Estados Unidos</td><td><code>country-US</code></td><td></td></tr></tbody></table>

</details>

<details>

<summary>Lista de países compatibles de Datacenter per traffic</summary>

<table><thead><tr><th>País</th><th>Código de país</th><th data-hidden></th></tr></thead><tbody><tr><td>Argentina</td><td><code>country-AR</code></td><td></td></tr><tr><td>Australia</td><td><code>country-AU</code></td><td></td></tr><tr><td>Austria</td><td><code>country-AT</code></td><td></td></tr><tr><td>Bélgica</td><td><code>country-BE</code></td><td></td></tr><tr><td>Brasil</td><td><code>country-BR</code></td><td></td></tr><tr><td>Canadá</td><td><code>country-CA</code></td><td></td></tr><tr><td>Chile</td><td><code>country-CL</code></td><td></td></tr><tr><td>China</td><td><code>country-CN</code></td><td></td></tr><tr><td>Croacia</td><td><code>country-HR</code></td><td></td></tr><tr><td>Colombia</td><td><code>country-CO</code></td><td></td></tr><tr><td>Dinamarca</td><td><code>country-DK</code></td><td></td></tr><tr><td>Estonia</td><td><code>country-EE</code></td><td></td></tr><tr><td>Francia</td><td><code>country-FR</code></td><td></td></tr><tr><td>Alemania</td><td><code>country-DE</code></td><td></td></tr><tr><td>Grecia</td><td><code>country-GR</code></td><td></td></tr><tr><td>Hungría</td><td><code>country-HU</code></td><td></td></tr><tr><td>India</td><td><code>country-IN</code></td><td></td></tr><tr><td>Indonesia</td><td><code>country-ID</code></td><td></td></tr><tr><td>Irlanda</td><td><code>country-IE</code></td><td></td></tr><tr><td>Israel</td><td><code>country-IL</code></td><td></td></tr><tr><td>Italia</td><td><code>country-IT</code></td><td></td></tr><tr><td>Japón</td><td><code>country-JP</code></td><td></td></tr><tr><td>Letonia</td><td><code>country-LV</code></td><td></td></tr><tr><td>Lituania</td><td><code>country-LT</code></td><td></td></tr><tr><td>México</td><td><code>country-MX</code></td><td></td></tr><tr><td>Países Bajos</td><td><code>country-NL</code></td><td></td></tr><tr><td>Nueva Zelanda</td><td><code>country-NZ</code></td><td></td></tr><tr><td>Noruega</td><td><code>country-NO</code></td><td></td></tr><tr><td>Perú</td><td><code>country-PE</code></td><td></td></tr><tr><td>Polonia</td><td><code>country-PL</code></td><td></td></tr><tr><td>Portugal</td><td><code>country-PT</code></td><td></td></tr><tr><td>Rumanía</td><td><code>country-RO</code></td><td></td></tr><tr><td>Arabia Saudita</td><td><code>country-SA</code></td><td></td></tr><tr><td>Singapur</td><td><code>country-SG</code></td><td></td></tr><tr><td>Eslovaquia</td><td><code>country-SK</code></td><td></td></tr><tr><td>Eslovenia</td><td><code>country-SI</code></td><td></td></tr><tr><td>Corea del Sur</td><td><code>country-KR</code></td><td></td></tr><tr><td>España</td><td><code>country-ES</code></td><td></td></tr><tr><td>Suecia</td><td><code>country-SE</code></td><td></td></tr><tr><td>Suiza</td><td><code>country-CH</code></td><td></td></tr><tr><td>Tailandia</td><td><code>country-TH</code></td><td></td></tr><tr><td>Reino Unido</td><td><code>country-GB</code></td><td></td></tr><tr><td>Estados Unidos</td><td><code>country-US</code></td><td></td></tr></tbody></table>

</details>

Por ejemplo, si quieres rotar solo el pool de proxies de Estados Unidos, usa el puerto rotativo `8000` junto con un parámetro  `country-US` en tu nombre de usuario:

```bash
curl -x dc.oxylabs.io:8000 -U 'user-USERNAME-country-US:PASSWORD' https://ip.oxylabs.io/location
```

**Ejemplos de código**

{% tabs %}
{% tab title="cURL" %}

```sh
curl -x dc.oxylabs.io:8000 -U 'user-USERNAME-country-COUNTRY:PASSWORD' https://ip.oxylabs.io/location
```

{% endtab %}

{% tab title="Python" %}

<pre class="language-python"><code class="lang-python">#pip install requests
<strong>import requests
</strong>
username = 'USERNAME'
password = 'PASSWORD'
country = 'COUNTRY'
proxy = 'dc.oxylabs.io:8000'

proxies = {
   "https": ('https://user-%s-country-%s:%s@%s' % (username, country, password, proxy))
}

response=requests.get("https://ip.oxylabs.io/location", proxies=proxies)

print(response.content)
</code></pre>

{% endtab %}

{% tab title="Node.js" %}

```javascript
//npm install axios
const axios = require("axios");
const https = require("https");

const client = axios.create({
    httpsAgent: new https.Agent({
        rejectUnauthorized: false,
    }),
});
const username = 'USERNAME';
const country = 'COUNTRY'
const password = 'PASSWORD'

client
    .get("https://ip.oxylabs.io/location", {
        proxy: {
            protocol: "https",
            host: "dc.oxylabs.io",
            port: 8000,
            auth: {
                username: `user-${username}-country-${country}`,
                password: password,
            },
        },
    })
    .then((res) => {
        console.log(res.data);
    })
    .catch((err) => console.error(err));

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$username = 'USERNAME';
$country = 'COUNTRY';
$password = 'PASSWORD';
$proxy = 'dc.oxylabs.io:8000';
$target = 'https://ip.oxylabs.io/location';

$request = curl_init($target);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_PROXY, $proxy);
curl_setopt($request, CURLOPT_PROXYUSERPWD, "user-$username-country-$country:$password");
$responseBody = curl_exec($request);
$error = curl_error($request);
curl_close($request);

if ($responseBody !== false) {
    echo 'Response: ' . $responseBody;
} else {
    echo 'Failed to connect to proxy: ' . $error;
}

```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	username, country, password, entry := "USERNAME", "COUNTRY", "PASSWORD", "dc.oxylabs.io:8000"

	proxy, err := url.Parse(fmt.Sprintf("https://user-%s-country-%s:%s@%s", username, country, password, entry))
	if err != nil {
		panic(err)
	}

	transport := &http.Transport{
		Proxy: http.ProxyURL(proxy),
	}
	client := &http.Client{Transport: transport}
	target := "https://ip.oxylabs.io/location"
	response, err := client.Get(target)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	body, err := io.ReadAll(response.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println("Response:")
	fmt.Println(string(body))
}

```

{% endtab %}

{% tab title="Java" %}

```java
package com.example;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Base64;

import org.apache.hc.client5.http.fluent.Request;
import org.apache.hc.core5.http.HttpHost;

public class App {
    public static void main(String[] args) throws IOException, URISyntaxException {
        String targetUrl = "http://ip.oxylabs.io/location";
        String username = "USERNAME";
        String country = "COUNTRY";
        String password = "PASSWORD";
        String proxy = "dc.oxylabs.io:8000";

        URI proxyURI = new URI(String.format("https://user-%s-country-%s:%s@%s", username, country, password, proxy));

        String basicAuth = new String(
                Base64.getEncoder()
                        .encode(
                                proxyURI.getUserInfo().getBytes()));
        String response = Request.get(targetUrl)
                .addHeader("Proxy-Authorization", "Basic " + basicAuth)
                .viaProxy(HttpHost.create(proxyURI))
                .execute().returnContent().asString();

        System.out.println(response);
    }
}

```

{% endtab %}

{% tab title="C#" %}

```csharp
using System.Net;

// .NET currently does not support HTTPS proxies
var proxy = new WebProxy {
    Address = new Uri("dc.oxylabs.io:8000"),
    Credentials = new NetworkCredential(
        userName: "user-USERNAME-country-COUNTRY",
        password: "PASSWORD"
    )
};

var httpClientHandler = new HttpClientHandler {Proxy = proxy};

using var client = new HttpClient(handler: httpClientHandler, disposeHandler: true);

var result = await client.GetStringAsync("https://ip.oxylabs.io/location");
Console.WriteLine(result);
```

{% endtab %}
{% endtabs %}

#### Diferencias entre los métodos de suscripción

`Datacenter per IP` los usuarios que proporcionen el puerto rotativo y `país` el parámetro recibirán una **IP aleatoria del país seleccionado desde su lista de Proxy** con cada nueva solicitud.\
\
`Datacenter per traffic` los usuarios que proporcionen el puerto rotativo y `país` el parámetro recibirá **una IP aleatoria del país seleccionado desde todo el pool de proxies.**

{% hint style="info" %}
Usamos la [**base de datos MaxMind GeoIP2**](https://www.maxmind.com/en/geoip2-databases) para determinar la ubicación de las IPs.&#x20;
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.oxylabs.io/products/es/proxies/datacenter-proxies/select-country.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
