Skip to main content

Arcane MCT

Internal package for Merchant Center (MCT) access. It talks to Google Shopping via Content API for Shopping v2.1 by default, with an optional migration path to the Merchant API (Accounts + Products client libraries).


Installation

Install from the monorepo (Poetry):

poetry add ../arcane-mct   # or your path to this package

Dependencies include arcane-core, arcane-datastore, arcane-credentials, and the Google Shopping client libraries (see pyproject.toml).


Usage

MctClient (service account only)

Use a GCP service account JSON to create a client and call MCT:

from arcane.mct import MctClient

client = MctClient(
    gcp_service_account="/path/to/service-account.json",
    user_email="user@example.com",  # optional; needed for user-delegated credentials
    secret_key_file="/path/to/secret.key",  # required when user_email is set
    gcp_project="my-gcp-project",
)

# Get the account display name for a merchant ID
name = client.get_mct_account_details(merchant_id=123456789)
print(name)  # e.g. "My Store"

# Check that the account is not a multi-client account (MCA); raises if it is
client.check_if_multi_client_account(merchant_id=123456789)

When you already have an MCT account dict (e.g. from your API), you can pass it instead of user_email:

client = MctClient(
    gcp_service_account="/path/to/service-account.json",
    mct_account={"creator_email": "user@example.com", ...},
    secret_key_file="/path/to/secret.key",
    gcp_project="my-gcp-project",
)
name = client.get_mct_account_details(merchant_id=123456789)

Using only the service account (no user credentials):

client = MctClient(
    gcp_service_account="/path/to/service-account.json",
)
name = client.get_mct_account_details(merchant_id=123456789)

check_access_before_creation

Before linking or creating an MCT account, you can verify that the user has access and that the account is not an MCA:

from arcane.mct import check_access_before_creation

should_use_user_access = check_access_before_creation(
    mct_account_id=123456789,
    user_email="user@example.com",
    gcp_service_account="/path/to/arcane-service-account.json",
    secret_key_file="/path/to/secret.key",
    gcp_project="my-gcp-project",
)
# Returns True if the user's credentials have access (use user access when linking).
# Raises MctAccountLostAccessException or MerchantCenterServiceDownException on failure.

Exceptions

  • MctAccountLostAccessException — The account is not accessible (e.g. wrong merchant ID, revoked access, or MCA when only sub-accounts are allowed).
  • MerchantCenterServiceDownException — The Merchant Center API is unavailable or returned a server error.

Merchant API migration

Content API for Shopping is being sunset (August 2026). You can switch to the Merchant API in two ways:

  1. Environment: set USE_MERCHANT_API=true (or 1) so all clients use the Merchant API when no explicit flag is passed.
  2. In code: pass use_merchant_api=True (or False) where supported:
    • MctClient(..., use_merchant_api=True)
    • check_access_before_creation(..., use_merchant_api=True)

If you omit use_merchant_api (or pass None), the backend is chosen from the USE_MERCHANT_API environment variable. Default is Content API (with a deprecation warning).

Metadata

Release files for arcane-mct 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arcane-mct 2.2.1
File Size Uploaded
arcane_mct-2.2.1.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for arcane-mct 2.2.1
File Interpreter ABI Platform
arcane_mct-2.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.8 kB

Release files / arcane_mct-2.2.1.tar.gz

Download URL arcane_mct-2.2.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
15b474d58d5f3825b7973e36563e60bf948f83ae2dffee20775692a9e98d38e4
BLAKE2b-256 checksum
How to use checksums
43de612f7c59b60168362ec08327911b27bdd6aa3d18fbe4a34cde34953cb749
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.12.14 Linux/6.17.0-1022-azure

Release files / arcane_mct-2.2.1-py3-none-any.whl

Download URL arcane_mct-2.2.1-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41aebdd5fceed12988c7c29a31a301d3b19cea2ad02dd44b1df118ea32fcce9b
BLAKE2b-256 checksum
How to use checksums
61a5e85559ec41cf1a7827d7fa3b09abcff2671a545f473af7cbd1eefcbda04d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.12.14 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page