> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oculusproxies.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Set Up Oculus Proxies With HTTPX

> HTTPX is a powerful, modern HTTP client that supports async requests, proxies, streaming, authentication, and WebSockets. It is a great alternative to requests, especially for asynchronous applications.

<img src="https://mintcdn.com/oculus/day9UcrIh9VvuyzX/integration-guides/img/oculus_integrations/httpx.png?fit=max&auto=format&n=day9UcrIh9VvuyzX&q=85&s=029a9622a6d5e56c4818678c97b6790d" alt="title" width="720" height="200" data-path="integration-guides/img/oculus_integrations/httpx.png" />

## What is HTTPX?

**HTTPX** is a modern HTTP client for Python that provides both synchronous and asynchronous APIs. It is useful for making HTTP requests, handling sessions, and working with proxies, authentication, and streaming responses. Together with **Oculus Proxies** you can perform the best requests

<Tip>
  If you’re using **Oculus** to access search engines like **Google, Bing, or Yandex** and facing connection issues, the proxy type could be the reason. **ISP Premium Proxies** ensure stable and unrestricted access, preventing blocks that standard proxies might encounter. Switching to **ISP Premium Proxies** can help maintain smooth and reliable performance.
</Tip>

<Steps>
  <Step title="Install Python">
    Verify that [Python](https://www.python.org/downloads/) is installed on your system before proceeding.
  </Step>

  <Step title="Install HTTPX">
    * Run the following command to install HTTPX:

    ```bash theme={null}
    pip install httpx
    ```

    * To enable SOCKS proxy support, install it with:

    ```bash theme={null}
    pip install httpx[socks]
    ```
  </Step>

  <Step title="Send a request">
    Copy the following code to configure **HTTPX with Oculus Proxies**, and remember to include the authentication details:

    * `username` - Use your Oculus's username.

    * `password` - Use your Oculus's password.

    * Basic request doesn't require Host and Port.

    ```python Python theme={null}
    import httpx

    # Define the destination website
    url = "https://httpbin.org/basic-auth/user/pass"

    # Define authentication credentials
    auth = ("username", "password")

    # Make the request with authentication
    response = httpx.get(url, auth=auth)

    # Print the response
    print(response.status_code)
    print(response.text)
    ```
  </Step>

  <Step title="SOCKS5 Request">
    Use the provided example to make a **SOCKS5 request** using HTTPX:

    * `username` - Your proxy's username.

    * `password` - Your proxy's password.

    * `host` - Your proxy's host.

    * `port` - Your proxy's port.

    ```python Python theme={null}
    import httpx

    # SOCKS5 proxy with authentication
    proxies = {
    "http://": "socks5://username:password@host:port",
    "https://": "socks5://username:password@host:port",
    }

    # Make a request through the SOCKS5 proxy
    response = httpx.get("https://httpbin.org/ip", proxies=proxies)

    # Print the response
    print(response.text)
    ```
  </Step>

  <Step title="Asynchronous Request">
    Refer to the example for making an **asynchronous request** with HTTPX:

    ```python Python theme={null}
    import httpx
    import asyncio

    async def fetch():
    async with httpx.AsyncClient() as client:
        response = await client.get("https://httpbin.org/basic-auth/user/pass", auth=("username", "password"))
        print(response.text)

    # Run the async function
    asyncio.run(fetch())
    ```
  </Step>
</Steps>
