Skip to main content

Package description

Project description

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

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

arcane_mct-2.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

arcane_mct-2.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file arcane_mct-2.1.0.tar.gz.

File metadata

  • Download URL: arcane_mct-2.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.14.0-1017-azure

File hashes

Hashes for arcane_mct-2.1.0.tar.gz
Algorithm Hash digest
SHA256 06aead77b878a3dc50c58b4c70eadae82fb7c08f2fdc080eb0eafa002d375b97
MD5 278361b7b17054a26ce5ceb0adc239e7
BLAKE2b-256 9561318ef94165f56504888ba35b79c048414cb023eddfb0160060c31dc1c5c5

See more details on using hashes here.

File details

Details for the file arcane_mct-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: arcane_mct-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.14.0-1017-azure

File hashes

Hashes for arcane_mct-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b81a3a287f4d41da440e8a1e2b0092676f222b7774144dc846b9482e1bf810df
MD5 b5e6873c4969a19849949b5fbacc2146
BLAKE2b-256 f3e8719e07fd796d48ee174d4f2cc71c8a28604fcf0c5a5e614356124e49722a

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