English | Русский
Async scrapers for Kaspi.kz, OLX.kz and Ozon.kz, one protocol.
Search a product, get every seller's offer with price and delivery, read reviews and specs. Use it for price monitors, deal bots and purchase research on Kazakhstan marketplaces.
Install
pip install market-sources # Kaspi; OLX needs the impersonate extra (below)
pip install "market-sources[impersonate]" # + curl_cffi, so OLX.kz's WAF lets requests through
pip install "market-sources[browser]" # + playwright, for Ozon.kz
playwright install chromium # once, for the browser extra
With uv: uv add "market-sources[impersonate,browser]".
Latest code: pip install "git+https://github.com/octrow/market-sources".
Needs Python 3.12+. Runtime dependencies are httpx and pydantic.
Extras load lazily, so import market_sources works without them.
Example
import asyncio
from market_sources import KaspiSource
async def main():
kaspi = KaspiSource()
products = await kaspi.search("iphone 15")
offers = await kaspi.offers(products[0].product_id)
cheapest = min(offers, key=lambda o: o.price)
print(products[0].title, "|", len(offers), "offers, from", cheapest.price, cheapest.currency)
await kaspi.aclose()
asyncio.run(main())
A real run on 2026-10-13. The Kaspi search took 1.4 s and returned 12 products:
Смартфон Apple iPhone 15 128Gb NanoSIM+eSIM черный | 32 offers, from 379500.0 KZT
Each offer is a plain Pydantic model:
RawOffer(source='kaspi', product_id='113137790', seller='Kaz_Phones', price=379500.0, currency='KZT',
delivery='EXPRESS', in_stock=True, merchant_rating=4.8, merchant_review_count=32,
delivery_date='2026-10-13', delivery_cost=995.0, ...)
Sources
KaspiSource: Kaspi's internal JSON API. Works with the base install.OlxSource: OLX's public JSON API. Needs theimpersonateextra.OzonSource: Ozon's composer API, read through a real browser. Needs thebrowserextra.KimovilSource: phone specs from kimovil.com. It is a spec reference, not aProductSource.
All sources share one protocol, so your code does not care which site it talks to:
class ProductSource(Protocol):
async def search(self, query: str, city: str | None = None) -> list[RawProduct]: ...
async def offers(self, product_id: str) -> list[RawOffer]: ...
async def reviews(self, product_id: str) -> list[RawReview]: ...
async def specs(self, product_id: str) -> dict[str, str]: ...
city takes a site id or a city name. market_sources.cities maps 21 cities to Kaspi and OLX ids. Ozon ignores the city.
Search options, env vars and the module list: docs/sources.md.
How it works
Each adapter splits network and parsing, so parsers are tested on saved payloads with no mocks. The models keep what the site said. Normalization, currency conversion, dedup and ranking are yours.
- Each site has its own gate: Kaspi checks the referer, OLX checks the TLS fingerprint, Ozon serves a JavaScript challenge. The adapters pass all three.
PoliteClientcaps concurrency, adds jittered delays and honorsRetry-After.asyncio.gatherover 40 pages will not flood a site.- Scrapy is a crawler framework. This is a small library you call from a bot, a FastAPI app or a cron script.
Please keep the default pacing, cache what you can, and follow each marketplace's terms.
Docs
- Sources, options and modules
- Design rules and tests
- Origin and changes from the original code
- Logic map: how a query becomes models
- Changelog
Contributing
See CONTRIBUTING.md. Report vulnerabilities privately: SECURITY.md.
License
Metadata
Release files for market-sources 0.6.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| market_sources-0.6.4.tar.gz | 73.4 kB | With provenance | Details for market_sources-0.6.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| market_sources-0.6.4-py3-none-any.whl | Python 3 | none | any | Details for market_sources-0.6.4-py3-none-any.whl |
Total release size: 126.1 kB
Release files / market_sources-0.6.4.tar.gz
| Download URL | market_sources-0.6.4.tar.gz |
|---|---|
| Size | 73.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8218f81fc5a294c6c49bb2f2f11f77bb7d74bcdcda68e7b5d7ef033ce1847477
|
|
BLAKE2b-256 checksum How to use checksums |
fa720053b47a8529af8155f2f8829e1a2da667fb945a13596a4b8c7c6aed33a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / market_sources-0.6.4-py3-none-any.whl
| Download URL | market_sources-0.6.4-py3-none-any.whl |
|---|---|
| Size | 52.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7408b8aa7d52b19096f68e08f8a5724a9618a2a27ac31021832ac979cdb495b2
|
|
BLAKE2b-256 checksum How to use checksums |
7f09b2f00343bdc10eaf1bdcd4e03b5316f5c788b07f0267bbae9debde6895c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for market-sources 0.6.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for market_sources-0.6.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.