Python SDK
BetaUse the official Getme Python SDK for server-side integrations and automation.
Getme Python is the official Python client for Getme developer APIs.
Installation
pip install getme-python
Python 3.10 or newer is required.
Source code: github.com/getme-tech/getme-python
Quick start
from getme import GetmeClient
client = GetmeClient(api_key="gmat_test_...")
sites = client.sites.list()
products = client.products.list(limit=10)
manifest = client.sites.source.manifest("site_...")
print([site["name"] for site in sites["data"]])
print([product["name"] for product in products["data"]])
print([file["path"] for file in manifest["files"]])
Use an app-install access token such as gmat_test_... or gmat_live_....
Pagination
first_page = client.sites.list(limit=25)
if first_page["has_more"] and first_page["data"]:
next_page = client.sites.list(
limit=25,
cursor=first_page["data"][-1]["id"],
)
For full scans:
for site in client.sites.list_auto_paging(limit=100):
print(site["id"], site["name"])
for product in client.products.list_auto_paging(limit=100):
print(product["id"], product["name"])
The SDK sends cursor as starting_after.
Commerce catalog
product = client.products.create({
"name": "Coffee",
"sku": "COF-001",
"status": "draft",
})
client.products.update(product["id"], {"status": "active"})
client.products.archive(product["id"])
client.categories.create({"name": "Menu", "type": "product"})
client.brands.create({"name": "Acme"})
client.services.create({"name": "Consulting"})
Mutations generate an idempotency key automatically unless you pass one in request options.
Website source
Create a standalone site directly from a complete custom source tree when no live site or base-theme selection exists:
custom = client.sites.development.create_from_source({
"name": "Custom storefront",
"message": "Initial source",
"files": custom_theme_files,
})
print(custom["site_id"], custom["id"], custom["source_revision"])
The API validates the full archive before creating the draft. The returned site and session ids intentionally match. Subsequent source writes, previews, and publish requests use the existing development-session methods.
session = client.sites.development.create_session(
"site_...",
{"source_revision": "rev_live", "name": "Header update"},
)
client.sites.development.push_batch(
"site_...",
session["id"],
{
"source_revision": "rev_live",
"files": {"theme.json": '{"name":"Updated theme"}'},
},
)
client.sites.pages.upsert_content(
"site_...",
session["id"],
"wpag_...",
"en",
{"source_revision": "rev_live", "values": {"title": "Updated docs"}},
)
preview = client.sites.development.preview(
"site_...",
session["id"],
{"expires_days": 7},
)
print(preview["preview_url"])
Source and page content writes are staged in the development session. They do not publish to the live site. Create a publish request when the change is ready for owner review.
Webhook verification
Use the raw request body bytes for signature verification.
from getme.webhooks import construct_event
event = construct_event(raw_body, signature_header, "whsec_...")
print(event["type"])
Testing helpers can create signed payloads for local tests:
from getme.webhooks.testing import generate_test_header, generate_test_payload
payload = generate_test_payload({"object": "event", "type": "website.published"})
signature = generate_test_header(payload["raw_body"], "whsec_test")
Errors
The Python SDK raises structured exceptions such as GetmeApiError, GetmeAuthenticationError, GetmePermissionError, GetmeRateLimitError, GetmeConnectionError, and GetmeSignatureVerificationError.