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

> ## Agent Instructions
> The Zenrows HTTP API serves Fetch and Extract (extract=auto) at https://api.zenrows.com/v1/, Crawl at https://api.zenrows.com/v1/crawls, and Batch at https://async.api.zenrows.com/v1. Fetch, Extract, Crawl and Batch are described in OpenAPI 3.1 at https://www.zenrows.com/openapi.json and listed in the RFC 9727 API catalog at https://www.zenrows.com/.well-known/api-catalog. Every endpoint also has its own page under /api-reference with its schema. Use the spec for exact parameter names and types. Crawl's endpoints, parameters and errors are also at https://docs.zenrows.com/crawl/endpoints.md. To call Zenrows from an agent, connect the MCP server at https://mcp.zenrows.com/mcp. To search these docs from an agent, connect the docs MCP server at https://docs.zenrows.com/mcp. Agent skills for Zenrows are published at https://github.com/ZenRows/cli and install with `npx skills add ZenRows/cli`.

# Making your first request with the Python SDK

> Make your first request with the Zenrows Python SDK in a few lines of code.

This guide makes a single GET request with the Zenrows Python SDK: create a client, send the request, read the response.

> [!NOTE]
>
> Haven't installed the SDK yet? Follow [Installation](https://docs.zenrows.com/fetch/sdk/python/installation.md) first.

## Basic usage

**1. Create a client**

Import `ZenRowsClient` and instantiate it with your API key:

```python theme={null} theme={"theme":"css-variables"}
from zenrows import ZenRowsClient

client = ZenRowsClient("YOUR_ZENROWS_API_KEY")
```

**2. Send a GET request**

Call `client.get()` with the URL you want to scrape:

```python theme={null} theme={"theme":"css-variables"}
from zenrows import ZenRowsClient

client = ZenRowsClient("YOUR_ZENROWS_API_KEY")
url = "https://www.scrapingcourse.com/ecommerce/"

response = client.get(url)

print(response.text)
```

`response` is a standard `requests.Response` object.

> [!TIP]
>
> See [The Response Object](https://docs.zenrows.com/fetch/sdk/python/response-object.md) for everything available on it.

**3. Add request parameters**

Pass a `params` dictionary to enable Fetch features like JavaScript rendering or Premium Proxies:

```python theme={null} theme={"theme":"css-variables"}
from zenrows import ZenRowsClient

client = ZenRowsClient("YOUR_ZENROWS_API_KEY")
url = "https://www.scrapingcourse.com/ecommerce/"

response = client.get(url, params={
    "js_render": True,
    "premium_proxy": True,
    "proxy_country": "us",
})

print(response.text)
```

> [!TIP]
>
> `params` accepts every parameter documented in the [Fetch setup guide](https://docs.zenrows.com/fetch/setup.md), including `extract`, `css_extractor`, `wait_for`, `block_resources`, and `outputs`. They all work exactly the same way through the SDK.

**4. Check the result**

Since the SDK doesn't raise an exception on non-2xx responses, always check the status before using the content:

```python theme={null} theme={"theme":"css-variables"}
if response.ok:
    print(response.text)
else:
    print(f"Request failed with status {response.status_code}: {response.text}")
```

See [Error Handling and Retries](https://docs.zenrows.com/fetch/sdk/python/error-handling-and-retries.md) for how to configure automatic retries so you don't have to handle every transient failure manually.

## Troubleshooting

* **`response.status_code` is `401` or similar auth error**: Double-check your API key was copied correctly from the Zenrows Request Playground with no extra whitespace. See [`AUTH002`](https://docs.zenrows.com/api-error-codes#auth002-invalid-api-key).

  [Open the Playground](https://app.zenrows.com/fetch)

* **`response.text` is empty or looks like an error page, not the target site**: The target likely needs `js_render=True` and/or `premium_proxy=True`. See [`REQS002`](https://docs.zenrows.com/api-error-codes#reqs002-request-requirements-unsatisfied).

* **Request hangs for a long time**: Pass a `timeout` keyword argument, e.g. `client.get(url, timeout=60)`. We recommend not going below 3 minutes for protected sites using `js_render`.

* **`429 Too Many Requests`**: You've hit your plan's concurrency or rate limit. See [Async Requests and Concurrency](https://docs.zenrows.com/fetch/sdk/python/async-concurrency.md).

## Pricing

Cost depends on the `params` you send, not on the SDK itself:

| Configuration | Credits per request |
| - | - |
| Basic request (no `js_render`/`premium_proxy`) | 1 |
| `js_render=True` | 5 |
| `premium_proxy=True` | 10 |
| `js_render=True` + `premium_proxy=True` | 25 |

Only successful requests are billed. See [Zenrows Pricing](https://docs.zenrows.com/first-steps/pricing.md) for exact per-plan rates.

## FAQ (Frequently Asked Questions)

> [accordion] Do I need params for every request?
>
> No, `params` is optional. `client.get(url)` alone works for public pages with no anti-bot protection.

> [accordion] Why doesn't a failed request raise an exception?
>
> By design, the SDK returns the `requests.Response` object even for error status codes. Check `response.ok` or call `response.raise_for_status()` yourself. See [Error Handling and Retries](https://docs.zenrows.com/fetch/sdk/python/error-handling-and-retries.md).

> [accordion] Can I reuse the same client for multiple requests?
>
> Yes. Create one `ZenRowsClient` instance and call `.get()`/`.post()`/`.put()` on it as many times as needed; there's no need to recreate it per request.

## What's next

> [card] [POST and PUT Requests](https://docs.zenrows.com/fetch/sdk/python/post-put-requests.md)
>
> Submit forms or data payloads.

> [card] [Async Requests and Concurrency](https://docs.zenrows.com/fetch/sdk/python/async-concurrency.md)
>
> Scrape many URLs in parallel.

> [card] [Custom Headers](https://docs.zenrows.com/fetch/sdk/python/custom-headers.md)
>
> Forward specific headers to the target site.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.