Metadata-Version: 2.5
Name: tarkov-market
Version: 1.0.0
Summary: Official client for the Tarkov Market API — live flea market prices and item data for Escape from Tarkov (PVP, PVE and season)
Project-URL: Homepage, https://tarkov-market.com
Project-URL: Documentation, https://tarkov-market.com/dev/api
Project-URL: Source, https://github.com/ggdiam/tarkov-market-api
Project-URL: Issues, https://github.com/ggdiam/tarkov-market-api/issues
Author: ggDiam
License: MIT License
        
        Copyright (c) 2026 ggDiam (Tarkov Market)
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: api-client,eft,escape-from-tarkov,flea-market,gaming,prices,tarkov,tarkov-market
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Games/Entertainment
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# tarkov-market

Official Python client for the [Tarkov Market](https://tarkov-market.com) API — live flea market
prices and item data for Escape from Tarkov, in PVP, PVE and season modes.

Standard library only, no dependencies. Python 3.9+.

```bash
pip install tarkov-market
```

## Usage

```python
import os
from tarkov_market import TarkovMarket

tm = TarkovMarket(api_key=os.environ["TARKOV_MARKET_KEY"])

# find an item by name — up to 5 matches, exact one first
ledx = tm.item(q="ledx")[0]
print(ledx.name, ledx.price, ledx.diff24h)

# or by id
by_uid = tm.item(uid="a7f7568c-61fb-437e-9f71-06e58aae26ba")[0]
by_bsg = tm.item(bsg_id="5c0530ee86f774697952d952")[0]

# the whole item list in one call
ammo = tm.all_items(tags=["Ammo"], sort="price", sort_direction="desc")
```

Get an API key at [tarkov-market.com/dev/api](https://tarkov-market.com/dev/api). Keep it out of
client-side code: it identifies you and the rate limit is per key.

## Game modes

```python
pve = TarkovMarket(api_key=key, mode="pve")     # for every call
tm.item(q="ledx", mode="season")                # just this one
```

Flea prices are never borrowed between modes. If the season has not seen an item yet you get
`price == 0` and `have_market_data is False` — check that flag before trusting a price.

## Item fields

Json is camelCase, the model is snake_case: `avg24hPrice` → `avg24h_price`,
`traderPriceRub` → `trader_price_rub`, `bsgId` → `bsg_id`. Anything the API adds later is still
reachable:

```python
ledx.raw["someNewField"]   # or ledx["someNewField"]
```

Full field list: [root README](../README.md#item-fields).

## Locales

```python
tm = TarkovMarket(api_key=key, lang="ru")
tm.item(q="ледх")
```

Non-latin queries are sent as POST automatically, so you never have to url-encode them.
Supported: `en ru ch cz de es fr hu it jp kr mx pl po ro sk tr`. Tags and `trader_name` stay
English in every locale — they are keys, not display text.

## Errors

```python
from tarkov_market import AuthError, RateLimitError, TarkovMarketError

try:
    tm.item(q="ledx")
except AuthError:          # 401 — key missing, unknown or disabled
    ...
except RateLimitError:     # 429 — 300/min, or 5/min for all_items
    ...
except TarkovMarketError as err:
    print(err.status, err.body)
```

`429` and `5xx` are retried twice with exponential backoff before the error reaches you.
Tune with `retries=`, `timeout=`.

## API

| Method | Does |
|---|---|
| `item(q=, uid=, bsg_id=, lang=, mode=)` | one item by name or id; returns `list[Item]` |
| `all_items(tags=, sort=, sort_direction=, lang=, mode=)` | every item; **5 calls/min** |
| `download_url(lang=, mode=)` | url of the full list as a json file (contains your key) |

## Examples

```bash
TARKOV_MARKET_KEY=your_key python examples/basic.py ledx
TARKOV_MARKET_KEY=your_key python examples/export_csv.py prices.csv pve
```

## License

MIT
