Skip to main content

Official SDK for MRC Data — China's apparel supply chain API

Project description

mrc-data

Official Python SDK for MRC Data -- China's apparel supply chain API.

Access 1,000+ verified suppliers, 350+ fabric specifications, and 170+ industrial clusters across China, each enriched with independent lab measurements (AATCC, ISO, GB).

Installation

pip install mrc-data

Quick start

from mrc_data import MRCData

client = MRCData(api_key="your-api-key")

# Search suppliers in Guangzhou
suppliers = client.search_suppliers(city="Guangzhou", certification="BSCI")

# Get supplier details
detail = client.get_supplier_detail("sup_abc123")

# Search fabrics by composition
fabrics = client.search_fabrics(composition="cotton", weight_min=150)

# Compare industrial clusters
comparison = client.compare_clusters(ids=["cls_humen", "cls_shaoxing"])

# Detect specification discrepancies
result = client.detect_discrepancy(supplier_id="sup_abc123", fabric_id="fab_xyz")

# Database statistics
stats = client.get_stats()

Async usage

import asyncio
from mrc_data import AsyncMRCData

async def main():
    async with AsyncMRCData(api_key="your-api-key") as client:
        suppliers = await client.search_suppliers(province="Guangdong")
        fabrics = await client.search_fabrics(weave="twill")
        print(suppliers)

asyncio.run(main())

API methods

Method Endpoint Description
search_suppliers(**kwargs) GET /v1/suppliers Search suppliers with filters
get_supplier_detail(id) GET /v1/suppliers/{id} Get a single supplier
get_supplier_fabrics(id) GET /v1/suppliers/{id}/fabrics List fabrics by supplier
search_fabrics(**kwargs) GET /v1/fabrics Search fabrics with filters
get_fabric_detail(id) GET /v1/fabrics/{id} Get a single fabric
get_fabric_suppliers(id) GET /v1/fabrics/{id}/suppliers List suppliers for a fabric
search_clusters(**kwargs) GET /v1/clusters Search industrial clusters
compare_clusters(ids) POST /v1/clusters/compare Compare clusters side by side
get_stats() GET /v1/stats Aggregate database statistics
detect_discrepancy(**kwargs) POST /v1/discrepancy Detect spec discrepancies

Error handling

from mrc_data import MRCData, AuthenticationError, NotFoundError, RateLimitError

client = MRCData(api_key="your-api-key")

try:
    detail = client.get_supplier_detail("sup_invalid")
except AuthenticationError:
    print("Check your API key")
except NotFoundError:
    print("Supplier not found")
except RateLimitError:
    print("Slow down -- rate limit exceeded")

Configuration

client = MRCData(
    api_key="your-api-key",
    base_url="https://api.meacheal.ai",  # default
    timeout=60.0,                         # seconds, default 30
)

Both MRCData and AsyncMRCData support context managers for automatic cleanup of the underlying HTTP connection pool.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mrc_data-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mrc_data-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file mrc_data-0.1.0.tar.gz.

File metadata

  • Download URL: mrc_data-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for mrc_data-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e52c0a1a574979929adfc4c0000258c3a61ca54eeced01885e75df14153d3b19
MD5 0900a84bf9fdff0f873dc9acd5c5b5b1
BLAKE2b-256 807e87fa88f68855215b23b06eae7f9f31944fd62cc28ba4faab930bb40e8f6e

See more details on using hashes here.

File details

Details for the file mrc_data-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mrc_data-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for mrc_data-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9dad0a3c6b584073d025e67b855bce45ca1a7d13dd48482a83e57477bc52c98e
MD5 6062822c99d394e727f6a361adf6e8d5
BLAKE2b-256 28b89dc43dcd99a257733e20abab3ce3ba041aaa081fc7639d1d448f068ea959

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page