dynamics365crm-python
API wrapper for Dynamics365CRM written in Python
What it is and what it does
dynamics365crm-python is a wrapper around the Microsoft Dynamics 365 CRM Web API that lets you interact with CRM records from Python code. It handles OAuth2 authentication against Azure AD and provides a client object with methods to query, create, update, and delete contacts, accounts, opportunities, leads, and campaigns. The library depends on msal for authentication and requests for HTTP calls.
The package supports both direct access-token authentication and the full OAuth2 code-exchange flow, including token refresh. It abstracts away the underlying REST API details, letting you work with CRM entities through simple method calls like get_contacts(), create_account(), and update_opportunity(). The library targets Dynamics 365 API version v9.0 and supports Python 3.7 through 3.11.
Use it for:
- Automate bulk contact or lead imports into Dynamics 365 from external data sources or ETL pipelines.
- Build a backend service that syncs opportunity or campaign data between Dynamics 365 and another business system.
- Create a Python script to query and export CRM records for reporting or analytics without manual portal access.
- Integrate Dynamics 365 CRM data into a web application or bot that needs read/write access to accounts and contacts.
- Develop a scheduled job that updates lead or campaign records based on external events or triggers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a Python client for interacting with Microsoft Dynamics 365 CRM via its Web API, supporting OAuth2 authentication and CRUD operations on contacts, accounts, opportunities, leads, and campaigns.
No—the project is abandoned and will receive no maintenance, bug fixes, or security patches. While the code may still work with current Dynamics 365 instances, you have no recourse if the API changes, dependencies break, or security issues emerge. For production use, seek an actively maintained alternative or consider building directly against the Dynamics 365 REST API.
Install
dynamics365crm-python on PyPI
pip
pip install dynamics365crm-pythonuv
uv add dynamics365crm-pythonpoetry
poetry add dynamics365crm-pythonInstalling dynamics365crm-python
Before you install
Installation is straightforward with low friction—the package depends only on msal and requests. However, the project is abandoned, meaning no bug fixes or security updates will be issued going forward.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute the package freely with minimal restrictions.
Quickstart
pip install dynamics365crm-python
from dynamics365crm.client import Client
client = Client(
"https://tenant_name.crmX.dynamics.com",
client_id="CLIENT_ID",
client_secret="CLIENT_SECRET"
)
contacts = client.get_contacts()
Requires Azure AD application credentials (client_id and client_secret) and a valid Dynamics 365 tenant domain to authenticate and connect.
Verify before relying
- Whether the package remains compatible with current Dynamics 365 API versions beyond v9.0 or if breaking changes have occurred.
- Current state of msal and requests dependencies—whether they have introduced breaking changes since the last release.
- Whether the OAuth2 flow implementation still aligns with current Microsoft Azure AD authentication best practices.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — msal, requests |
| Maintenance | abandoned — 1,208 days since the last release |
| First released | |
| Downloads | 79,668/month — #14,343 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: dynamics365crm_python-1.0.2-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
hubspot-api-clientPython SDK for the HubSpot API v3 that provides…
permissive · top 5,000 on PyPI
marketorestpythonPython client library that wraps the Marketo…
permissive · top 15,000 on PyPI
pycdcSearches the web for gift ideas and client…
permissive · top 15,000 on PyPI
oauth2-clientHandles OAuth2 authentication flows…
unclear · top 15,000 on PyPI
microsoftgraph-pythonA Python wrapper for the Microsoft Graph API…
permissive · top 15,000 on PyPI
linkedin-api-clientProvides a Python client for LinkedIn's Rest.li…
unclear · top 5,000 on PyPI
office365-rest-python-clientPython client library for Microsoft 365 and…
permissive · top 5,000 on PyPI
o365O365 provides a Pythonic interface to Microsoft…
permissive · top 5,000 on PyPI
PowerPlatform-Dataverse-ClientA Python client library for Microsoft Dataverse…
unclear · top 15,000 on PyPI
pinterest-api-sdkPython client library for the Pinterest API…
permissive · top 15,000 on PyPI