Metadata-Version: 2.5
Name: darak
Version: 0.2.0
Summary: Official Python client for the Darak API: Saudi real-estate listings and market data.
Project-URL: Documentation, https://platform.darak.app/docs
Project-URL: Changelog, https://platform.darak.app/changelog
License-Expression: MIT
Keywords: api,darak,listings,real-estate,saudi-arabia
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# darak

The official Python client for the [Darak API](https://platform.darak.app/docs): every live rental and sale listing in Saudi Arabia, deduplicated across 13+ sources. Standard library only, Python 3.9+.

```bash
pip install darak
```

```python
from darak import Darak, DarakError

darak = Darak()  # reads DARAK_API_KEY

page = darak.listings.search(city="riyadh", listing_type="rent", beds=3, limit=25)
print(page["data"][0]["price"]["yearly_sar"])

# Every result, fetching pages as you go (stops at your plan's paging depth).
for listing in darak.listings.search_all(city="jeddah", listing_type="sale"):
    print(listing["id"], listing["location"]["neighborhood_name_en"])

try:
    darak.listings.get(1)
except DarakError as e:
    print(e.status, e.code, e.request_id)
```

Get a key at [platform.darak.app](https://platform.darak.app).

- Lists are sent comma-separated: `property_type=["apartment", "villa"]`.
- `429` and `5xx` (and network errors) are retried, honoring `Retry-After`. A monthly-quota `429` isn't waited out; it raises.
- Namespaces, generated from the API's OpenAPI spec so they track it exactly:
  `listings`, `market`, `analytics`, `projects`, `reference`, `brokers`, and
  `organization` (admin keys). `listings.search_all(...)` pages for you by
  following the cursor, and `request(method, path, query, body)` reaches
  anything not yet wrapped.
- `cities.list / neighborhoods / directions` still work; they are the 0.1.0
  names for what is now `reference`.

Tests: `python3 -m unittest discover -s tests`.
