Skip to main content

Official Python SDK for the Sellium API.

Project description

sellium (Sellium Python SDK)

Official, production-ready Python SDK for the Sellium API (v1).

This SDK provides a single SelliumClient with service groups for:

  • Store
  • Products
  • Orders
  • Coupons
  • Customers
  • Tickets
  • Feedback
  • Groups
  • Blacklist

Works great for building dashboards, automations, and integrations on top of Sellium.


Requirements

  • Python 3.9+

Install

From PyPI (recommended)

pip install sellium

From GitHub

pip install git+https://github.com/Sellium-site/sellium-python.git

Local development (editable)

From the repo root:

pip install -e .

Quick Start

from sellium import SelliumClient, APIError

BASE_URL = "https://yourdomain.com/api/v1"

client = SelliumClient(
    api_key="YOUR_API_KEY",
    store_id="YOUR_STORE_ID",
    base_url=BASE_URL,
)

try:
    data, meta = client.products.list(page=1, limit=20)
    print("Products:", len(data["data"]["products"]))

    if meta.rate_limit:
        print("Rate remaining:", meta.rate_limit.remaining)

except APIError as e:
    print("API Error:", e)

finally:
    client.close()

Client Options

from sellium import SelliumClient

client = SelliumClient(
    api_key="API_KEY",
    store_id="STORE_ID",
    base_url="https://yourdomain.com/api/v1",
    user_agent="my-app/1.0",
    timeout=30.0,
)

Services & Endpoints

Store

  • GET /store
data, meta = client.store.get()

Products

  • GET /products
  • POST /products
  • GET /products/{productId}
  • PATCH /products/{productId}
  • DELETE /products/{productId}
data, meta = client.products.list(page=1, limit=25, active=True, group_id="group_id")
data, meta = client.products.create({"name": "Item", "price_in_cents": 999, "delivery_type": "file"})
data, meta = client.products.get("product_id")
data, meta = client.products.update("product_id", {"price_in_cents": 1299})
data, meta = client.products.delete("product_id")

Orders

  • GET /orders
  • POST /orders
  • GET /orders/{orderId}
  • PATCH /orders/{orderId}
data, meta = client.orders.list(page=1, limit=25, status="pending")
data, meta = client.orders.create({"product_id": "pid", "customer_email": "a@b.com", "quantity": 1})
data, meta = client.orders.get("order_id")
data, meta = client.orders.update("order_id", {"status": "completed"})

Coupons

  • GET /coupons
  • POST /coupons
  • GET /coupons/{couponId}
  • PATCH /coupons/{couponId}
  • DELETE /coupons/{couponId}
data, meta = client.coupons.list(page=1, limit=25, active=True)
data, meta = client.coupons.create({"code": "NEW10", "type": "percentage", "value": 10})
data, meta = client.coupons.get("coupon_id")
data, meta = client.coupons.update("coupon_id", {"is_active": False})
data, meta = client.coupons.delete("coupon_id")

Customers

  • GET /customers
  • GET /customers/{email}
data, meta = client.customers.list(page=1, limit=25, email="gmail.com")
data, meta = client.customers.get("customer@example.com")

Tickets

  • GET /tickets
  • GET /tickets/{ticketId}
  • POST /tickets/{ticketId}/reply
  • PATCH /tickets/{ticketId}
data, meta = client.tickets.list(page=1, limit=25, status="open", priority="high")
data, meta = client.tickets.get("ticket_id")
data, meta = client.tickets.reply("ticket_id", {"message": "Thanks! We'll help you shortly."})
data, meta = client.tickets.update("ticket_id", {"status": "closed"})

Feedback

  • GET /feedback
  • GET /feedback/{feedbackId}
  • PATCH /feedback/{feedbackId}
data, meta = client.feedback.list(page=1, limit=25, rating=5, has_response=False)
data, meta = client.feedback.get("feedback_id")
data, meta = client.feedback.update("feedback_id", {"response": "Appreciate it!", "is_visible": True})

Groups

  • GET /groups
  • POST /groups
  • GET /groups/{groupId}
  • PATCH /groups/{groupId}
  • DELETE /groups/{groupId}
data, meta = client.groups.list(page=1, limit=25, active=True)
data, meta = client.groups.create({"name": "Boosts", "is_active": True})
data, meta = client.groups.get("group_id")
data, meta = client.groups.update("group_id", {"name": "Boosts (Updated)"})
data, meta = client.groups.delete("group_id")

Blacklist

  • GET /blacklist
  • GET /blacklist/{entryId}
  • POST /blacklist
  • DELETE /blacklist/{entryId}
data, meta = client.blacklist.list(page=1, limit=25, type="email", search="@gmail.com")
data, meta = client.blacklist.get("entry_id")
data, meta = client.blacklist.create({"type": "email", "value": "blocked@example.com", "reason": "Chargebacks"})
data, meta = client.blacklist.delete("entry_id")

Response Meta (Rate Limits)

Most methods return (data, meta).

data, meta = client.products.list(page=1, limit=10)

if meta.rate_limit:
    print(meta.rate_limit.limit, meta.rate_limit.remaining, meta.rate_limit.reset_sec)

Errors

Errors raise APIError:

from sellium import APIError

try:
    client.products.get("bad_id")
except APIError as e:
    print(e.status, e.code, e.message)

Project Structure

sellium-python/
├── sellium/
│   ├── __init__.py
│   ├── client.py
│   ├── errors.py
│   ├── types.py
│   ├── _http.py
│   └── services/
│       ├── __init__.py
│       ├── store.py
│       ├── products.py
│       ├── orders.py
│       ├── coupons.py
│       ├── customers.py
│       ├── tickets.py
│       ├── feedback.py
│       ├── blacklist.py
│       └── groups.py
└── examples/
    └── basic.py

Development

Optional lint:

python -m pip install ruff
ruff check .

Quick import sanity check:

python -c "from sellium import SelliumClient; print('ok')"

License

MIT License


Contributing

Pull requests are welcome.
Please ensure all code is formatted with gofmt and passes go test ./... before submitting.


Support

For questions or issues related to the Sellium API, please refer to the official Sellium documentation or open an issue in this repository.

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

sellium-0.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

sellium-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sellium-0.1.0.tar.gz
Algorithm Hash digest
SHA256 73b5008477864e338cf8cfef0e4dc1b7649e7fceb233575e637a72928180311d
MD5 ac6c364dddbbf1cf496b2d2fa8883c8a
BLAKE2b-256 8794d2f01fc7b4b76d905baeb8c0996443e61667e051a118fd33f45b5a0ea0a0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for sellium-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27f5fadb6121970cfb64fc4543b0c931249d240ca8b56ff5de23d3f3d740b0aa
MD5 0465b8e81825ad4b4ad7b6dca2a7fcd5
BLAKE2b-256 2cc42f606797faf3f09f77445b166a876f2af24bdcbb52a5e1b44d06339e6f9a

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