# Python SDK - search API - country filter

**URL:** <https://community.perplexity.ai/t/python-sdk-search-api-country-filter/2391>\
**Category:** Bug Reports\
**Tags:** search-api\
**Created:** [October 31, 2025, 6:44am UTC](https://community.perplexity.ai/t/python-sdk-search-api-country-filter/2391 "2025-10-31T06:44:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin](https://sea1.discourse-cdn.com/flex001/user_avatar/community.perplexity.ai/martin/32/1623_2.png) [@martin](https://community.perplexity.ai/u/martin)\
**Post date:** [October 31, 2025, 6:44am UTC](https://community.perplexity.ai/t/python-sdk-search-api-country-filter/2391/1 "2025-10-31T06:44:38Z")

</div>

## 🐛 Describe the Bug

When attempting a regional search using the python SDK, a interpreter error is returned.

> **[Quickstart - Perplexity](https://docs.perplexity.ai/guides/search-quickstart#regional-search)**
>
> Get started with Perplexity's Search API to retrieve ranked web search results with advanced filtering and customization options.

## ✅ Expected Behavior

The search should go through

## ❌ Actual Behavior

Python Interpreter Error:

`Traceback (most recent call last): File “_udf_code.py”, line 16, in main search = client.search.create( ^^^^^^^^^^^^^^^^^^^^^ TypeError: SearchResource.create() got an unexpected keyword argument ‘country’ in function F_PROMPT_TO_PERPLEXITY_SEARCH with handler main`

## 🔄 Steps to Reproduce

1. Create a function using perplexityai-0.19.0-py3-none-any.whl

```python
from perplexity import Perplexity

def main(prompt: str) → dict:
    client = Perplexity(api_key=[API KEY HERE])

    # Make the API call
    search = client.search.create(
        query=prompt,
        country="CH",
        max_results=5,
        max_tokens_per_page=1024
    )

    # Extract search result text and URLs
    search_results = []
    for result in search.results:
        search_result = {
            'doc_title': result.title,
            'doc_id': result.url,
            'text': result.snippet
        }
        search_results.append(search_result)

    return search_results

```

1. Execute the function
2. Observe the error.

## 📌 API Request & Response (if applicable)

n/a

## 🌍 Environment

- **API Version:** n/a
- **SDK (if applicable):** Python SDK v0.19.0
- **Operating System:** n/a

## 📎 Logs or Screenshots (if applicable)

n/a

## 📝 Additional Context

n/a
