office365-rest-python-client
Microsoft 365 & Microsoft Graph Library for Python
What it is and what it does
office365-rest-python-client is a Python wrapper around Microsoft 365 and Microsoft Graph REST APIs. It provides two main entry points: ClientContext for SharePoint REST API v1 operations (lists, files, folders, permissions) and GraphClient for Microsoft Graph operations (Outlook, OneDrive, Teams, OneNote, Planner, users, groups). All authentication flows use Azure AD via the msal library, with support for certificate-based app-only access, interactive browser login, device code flow, and username/password delegation.
The library abstracts away REST call details, batching, and pagination. It handles common patterns like bulk item creation, filtering, selecting fields, and expanding related objects through a fluent query interface. It supports multiple Azure environments (Global, US Government variants, China, Germany) and is actively maintained with recent releases and community sponsorship options available.
Use it for:
- Automate SharePoint list operations: bulk-create items, query with filters, manage permissions and folders programmatically.
- Build integrations with Outlook, OneDrive, or Teams using Microsoft Graph without writing raw HTTP requests.
- Migrate legacy SAML-based SharePoint automation to modern Azure AD certificate-based authentication.
- Sync data between SharePoint lists and external systems via scheduled Python scripts.
- Manage Microsoft 365 users, groups, and organizational structure through Graph API.
- Upload, download, and organize files in SharePoint document libraries and OneDrive.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python client library for Microsoft 365 and Microsoft Graph APIs, covering SharePoint REST API v1, Outlook, OneDrive, Teams, OneNote, Planner, and modern Azure AD authentication flows.
Yes. The library is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive MIT license. It covers a large surface of Microsoft 365 APIs with modern authentication and is widely used (top 5000 PyPI packages). Install it if you need to automate SharePoint, Outlook, Teams, or OneDrive operations from Python.
Install
office365-rest-python-client on PyPI
pip
pip install office365-rest-python-clientuv
uv add office365-rest-python-clientpoetry
poetry add office365-rest-python-clientInstalling office365-rest-python-client
Before you install
Low install friction with a pure-Python wheel. Actively maintained with a release 12 days ago and 1716 GitHub stars. Depends on msal, pytz, requests, and typing-extensions—all stable, widely-used libraries.
License in practice
MIT license permits unrestricted use, modification, and distribution in commercial and private projects with only attribution required.
Quickstart
pip install office365-rest-python-client
from office365.sharepoint.client_context import ClientContext
ctx = ClientContext("{site_url}").with_client_certificate(
tenant="{tenant}", client_id="{client_id}",
thumbprint="{thumbprint}", cert_path="./cert.pem"
)
web = ctx.web.get().execute_query()
print(f"Site title: {web.title}")
Requires Python 3.8 or later. Azure AD credentials (tenant, client_id, and certificate or secret) must be configured before authentication.
Verify before relying
- Whether the library handles pagination and throttling transparently for large result sets beyond the 5000-row threshold mentioned in examples.
- Current API coverage breadth across all Microsoft Graph endpoints (OneNote, Planner, etc.) and any known gaps.
- Performance characteristics and memory usage when working with large files or bulk operations.
Package facts
| License | The MIT License (MIT) Copyright (c) 2016 Vadim Gremyachev Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.8.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — msal, pytz, requests, typing-extensions |
| Maintenance | actively maintained — 12 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 17,285,720/month — #1,124 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: office365_rest_python_client-3.0.0-py3-none-any.whl
Tags
More Libraries 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
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
msgraph-sdkPython client library for calling Microsoft…
permissive · top 5,000 on PyPI
o365O365 provides a Pythonic interface to Microsoft…
permissive · top 5,000 on PyPI
SharePlumSharePlum provides a Python interface to…
permissive · top 5,000 on PyPI
sharepyHandles authentication to SharePoint Online and…
copyleft · top 15,000 on PyPI
microsoftgraph-pythonA Python wrapper for the Microsoft Graph API…
permissive · top 15,000 on PyPI
office365Wraps the O365 library to provide a…
permissive · top 15,000 on PyPI
msgraphfsProvides a filesystem interface to Microsoft…
permissive · top 5,000 on PyPI
msgraph-beta-sdkProvides async-first Python bindings to the…
unclear · top 15,000 on PyPI
PowerPlatform-Dataverse-ClientA Python client library for Microsoft Dataverse…
unclear · top 15,000 on PyPI
microsoft-teams-apiHTTP client library for Microsoft Teams Bot…
permissive · top 5,000 on PyPI