> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/pt-br/proxies/datacenter-proxies/select-country.md).

# Selecionar país

Aprenda a segmentar locais específicos de proxy e como usar a lógica de rotação.

Se você quiser acessar IPs de locais específicos, você precisa fornecer um `país` – parâmetro com um código de país de duas letras em seu nome de usuário. Aqui está a lista de `país` parâmetros. Por exemplo, se você quiser usar o parâmetro de país dos Estados Unidos, adicione `country-US`.

Encontre a lista completa de países suportados na tabela abaixo.

<details>

<summary><strong>Lista de países suportados para Datacenter por IP</strong></summary>

<table><thead><tr><th>País</th><th>Código do 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>Austrália</td><td><code>country-AU</code></td><td></td></tr><tr><td>Áustria</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>Colômbia</td><td><code>country-CO</code></td><td></td></tr><tr><td>Croácia</td><td><code>country-HR</code></td><td></td></tr><tr><td>República Tcheca</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>Finlândia</td><td><code>country-FI</code></td><td></td></tr><tr><td>França</td><td><code>country-FR</code></td><td></td></tr><tr><td>Alemanha</td><td><code>country-DE</code></td><td></td></tr><tr><td>Índia</td><td><code>country-IN</code></td><td></td></tr><tr><td>Indonésia</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>Itália</td><td><code>country-IT</code></td><td></td></tr><tr><td>Japão</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 Baixos</td><td><code>country-NL</code></td><td></td></tr><tr><td>Peru</td><td><code>country-PE</code></td><td></td></tr><tr><td>Filipinas</td><td><code>country-PH</code></td><td></td></tr><tr><td>Polônia</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>Romênia</td><td><code>country-RO</code></td><td></td></tr><tr><td>Arábia Saudita</td><td><code>country-SA</code></td><td></td></tr><tr><td>Singapura</td><td><code>country-SG</code></td><td></td></tr><tr><td>Eslováquia</td><td><code>country-SK</code></td><td></td></tr><tr><td>Espanha</td><td><code>country-ES</code></td><td></td></tr><tr><td>Suíça</td><td><code>country-CH</code></td><td></td></tr><tr><td>Tailândia</td><td><code>country-TH</code></td><td></td></tr><tr><td>Emirados Á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><strong>Lista de países suportados para Datacenter por tráfego</strong></summary>

<table><thead><tr><th>País</th><th>Código do 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>Austrália</td><td><code>country-AU</code></td><td></td></tr><tr><td>Áustria</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>Colômbia</td><td><code>country-CO</code></td><td></td></tr><tr><td>Croácia</td><td><code>country-HR</code></td><td></td></tr><tr><td>Dinamarca</td><td><code>country-DK</code></td><td></td></tr><tr><td>Estônia</td><td><code>country-EE</code></td><td></td></tr><tr><td>Finlândia</td><td><code>country-FI</code></td><td></td></tr><tr><td>França</td><td><code>country-FR</code></td><td></td></tr><tr><td>Alemanha</td><td><code>country-DE</code></td><td></td></tr><tr><td>Grécia</td><td><code>country-GR</code></td><td></td></tr><tr><td>Hungria</td><td><code>country-HU</code></td><td></td></tr><tr><td>Índia</td><td><code>country-IN</code></td><td></td></tr><tr><td>Indonésia</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>Itália</td><td><code>country-IT</code></td><td></td></tr><tr><td>Japão</td><td><code>country-JP</code></td><td></td></tr><tr><td>Letônia</td><td><code>country-LV</code></td><td></td></tr><tr><td>Lituânia</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 Baixos</td><td><code>country-NL</code></td><td></td></tr><tr><td>Nova Zelândia</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>Peru</td><td><code>country-PE</code></td><td></td></tr><tr><td>Polônia</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>Romênia</td><td><code>country-RO</code></td><td></td></tr><tr><td>Arábia Saudita</td><td><code>country-SA</code></td><td></td></tr><tr><td>Singapura</td><td><code>country-SG</code></td><td></td></tr><tr><td>Eslováquia</td><td><code>country-SK</code></td><td></td></tr><tr><td>Eslovênia</td><td><code>country-SI</code></td><td></td></tr><tr><td>Coreia do Sul</td><td><code>country-KR</code></td><td></td></tr><tr><td>Espanha</td><td><code>country-ES</code></td><td></td></tr><tr><td>Suécia</td><td><code>country-SE</code></td><td></td></tr><tr><td>Suíça</td><td><code>country-CH</code></td><td></td></tr><tr><td>Tailândia</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 exemplo, se você quiser rotacionar apenas o pool de proxy dos Estados Unidos, use a porta rotativa `8000` junto com um parâmetro `country-US` em seu nome de usuário:

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

**Exemplos 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 'Resposta: ' . $responseBody;
} else {
    echo 'Falha ao conectar ao 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("Resposta:")
	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;

// Atualmente, o .NET não oferece suporte a proxies HTTPS
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 %}

#### Diferenças entre os métodos de assinatura

`Datacenter por IP` os usuários que fornecem a porta rotativa e `país` o parâmetro receberá uma **IP aleatório do país selecionado da sua lista de proxies** a cada nova solicitação.\
\
`Datacenter por tráfego` os usuários que fornecem a porta rotativa e `país` o parâmetro receberá **IP aleatório do país selecionado de todo o pool de proxies.**

{% hint style="info" %}
Usamos o [**MaxMind GeoIP2**](https://www.maxmind.com/en/geoip2-databases) banco de dados para determinar a localização dos IPs.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/products/pt-br/proxies/datacenter-proxies/select-country.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
