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.0

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.0
File Size Uploaded
arcane_mct-2.2.0.tar.gz 5.8 kB Details

Built distribution (wheel)

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

Total release size: 13.8 kB

Release files / arcane_mct-2.2.0.tar.gz

Download URL arcane_mct-2.2.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
65cd27feda7e3ca000a157f407f1566e1d8d5639bac526e3e6bcea8ffc41e6d3
BLAKE2b-256 checksum
How to use checksums
6d10f344b49dbbc7350b60730bf68a58495cd4662a4d240046a933fb24586f75
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.0-py3-none-any.whl

Download URL arcane_mct-2.2.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e86189ca6f246db76316f43721e72f64c2fa5b39f862ef5a9464187ca7b27e8b
BLAKE2b-256 checksum
How to use checksums
08058b6ce2fd1c9d8237d9de7ef7f828967dea18afe7b817aa39421e77a595ac
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

2.2.1

2 release files

This release

2.2.0 This release

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