async API wrapper for Tarkov Market written in Python.
Project description
async wrapper for Tarkov Market API written in Python.
Installing
Python 3.8 or higher is required
# Linux/macOS
python3 -m pip install -U tarkov-market.py
# Windows
py -3 -m pip install -U tarkov-market.py
Quick Examples
Basic use with use client
import asyncio
import tarkov_market
from typing import List
from tarkov_market import Item
TOKEN: str = 'YOUR API KEY'
market = tarkov_market.Client(token=TOKEN, refresh_rate=None)
async def main() -> None:
# return only one of the search results
item: Item = await market.fetch_item('TerraGroup Labs keycard (Red)')
print(item.name, item.price)
# return all search results
items: List[Item] = await market.fetch_items('key')
for item in items:
print(item.name, item.price)
'''
The fetch functions has a limit of 300 requests per minute because it communicates directly with the API.
If you have a large number of requests, check the example in the link below.
cache example: https://github.com/Hostagen/tarkov-market.py/blob/master/examples/cache.py
Unrestricted by pre-loading and caching data once.
'''
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.run_forever()
Simple to use without client declaration
import asyncio
from typing import List
from tarkov_market import Client as TVMClient, Item
TOKEN: str = 'YOUR API KEY'
async def main():
async with TVMClient(token=TOKEN) as api:
item: Item = await api.fetch_item('TerraGroup Labs keycard (Red)')
print(item.name, item.price)
items: List[Item] = await api.fetch_items('key')
for item in items:
print(item.name, item.price)
# When you exit the `async with` syntax, aiohttp.ClientSession is automatically and securely terminated.
# When you use the `async with` with again, a new aiohttp.ClientSession is created again.
async with TVMClient(token=TOKEN) as api:
...
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
More Examples
https://github.com/Hostagen/tarkov-market.py/tree/master/examples
Update Logs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tarkov-market.py-0.15.0.tar.gz
(11.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tarkov-market.py-0.15.0.tar.gz.
File metadata
- Download URL: tarkov-market.py-0.15.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37aaeb68cc69ed5d766af60fb848e9e18ae6ecaf7ff16d060b504130626b3b3b
|
|
| MD5 |
4e944e8dcf6f1e09bc70e87bf8b6bbc3
|
|
| BLAKE2b-256 |
f9ee579566d7a6c98f25f596bb86a56ba302121b837e4b6fa73b4bdf632944af
|
File details
Details for the file tarkov_market.py-0.15.0-py3-none-any.whl.
File metadata
- Download URL: tarkov_market.py-0.15.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
836381618cd798fd2fa775b675aec452f449245a22b6cc3a1b855d656d00c8a6
|
|
| MD5 |
360909c56f50691beaa7731c74b70167
|
|
| BLAKE2b-256 |
0d32507bd92fdc27aa816d7cf4a847a5273a38579d8a69f109647f02da09e3f0
|