{"id":27969,"library":"mparticle","title":"mParticle Python SDK","description":"Python client for the mParticle customer data platform. Currently version 0.16.1. SDK supports event tracking, user management, and consent state. Maintenance cadence is irregular with occasional feature releases.","status":"active","version":"0.16.1","language":"python","source_language":"en","source_url":"https://github.com/mParticle/mparticle-python-sdk","tags":["mParticle","CDP","customer data","analytics","event tracking"],"install":[{"cmd":"pip install mparticle","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"HTTP client for API calls","package":"requests","optional":false},{"reason":"Python 2/3 compatibility","package":"six","optional":false},{"reason":"Date/time parsing","package":"python-dateutil","optional":false}],"imports":[{"note":null,"wrong":null,"symbol":"Batch","correct":"from mparticle import Batch"},{"note":null,"wrong":null,"symbol":"MParticle","correct":"from mparticle import MParticle"},{"note":null,"wrong":null,"symbol":"Event","correct":"from mparticle import Event"},{"note":"UserIdentities is a model in the separate models module, not directly in mparticle top-level","wrong":"from mparticle import UserIdentities","symbol":"UserIdentities","correct":"from mparticle.models import UserIdentities"}],"quickstart":{"code":"from mparticle import MParticle\nfrom mparticle import Event\nfrom mparticle.models import UserIdentities\n\napi_key = os.environ.get('MPARTICLE_API_KEY', '')\napi_secret = os.environ.get('MPARTICLE_API_SECRET', '')\n\nmp = MParticle(api_key, api_secret)\n\n# Track a simple event\nevent = Event('Test Event', 'navigation')\nmp.log_event(event)\n\n# Track with user identity\nuser_ids = UserIdentities(customer_id='user123')\nmp.log_event(event, user_identities=user_ids)","lang":"python","description":"Initialize mParticle client with API credentials and log a custom event."},"warnings":[{"fix":"Watch for API version updates in the official changelog.","message":"The SDK uses v2 of the mParticle Events API, but some endpoints may be removed in future versions.","severity":"deprecated","affected_versions":">=0.10.0,<0.17.0"},{"fix":"Import from mparticle.models instead of mparticle.","message":"UserIdentities moved from top-level to mparticle.models in v0.11.0.","severity":"breaking","affected_versions":">=0.11.0"},{"fix":"Use mp.upload() with a Batch object to send batched events.","message":"Batch uploads require setting the batch endpoint correctly; default config may not batch as expected.","severity":"gotcha","affected_versions":"all"},{"fix":"Use Python 3.5+.","message":"Python 3.5 minimum since v0.13.0; Python 2.7 support dropped.","severity":"deprecated","affected_versions":">=0.13.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use 'from mparticle.models import UserIdentities' instead.","cause":"UserIdentities is in the models submodule, not top-level.","error":"AttributeError: module 'mparticle' has no attribute 'UserIdentities'"},{"fix":"Verify your mParticle API credentials and ensure environment variables are set correctly.","cause":"Invalid API key or secret.","error":"mparticle.exceptions.MParticleError: 401 Unauthorized"},{"fix":"Call 'mp.log_event(event)' with the event as a positional argument.","cause":"Passing event object as keyword argument incorrectly.","error":"TypeError: log_event() missing 1 required positional argument: 'event'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}