$ show O365/python-o365
python-o365 is a mature Python library that provides a comprehensive, object-oriented wrapper around the Microsoft Graph API. It enables developers to programmatically access and manage Microsoft 365 services including Outlook email and calendar, OneDrive and SharePoint files, Teams chats and presence, Planner tasks, directory users and groups, and more. The library abstracts OAuth2 authentication (supporting authorization code, public client, and client credentials flows) and handles token refresh, pagination, and API versioning internally. It is designed as a client-side SDK, not a server application, and can be embedded into scripts, web applications (e.g., Flask), or automation workflows.
The LLM identified 5 files worth highlighting for reuse:
Contains the `ApiComponent` base class that all API resource objects inherit from, providing URL building, camelCase/snake_case conversion, and query aliasing. Also includes `Pagination` (an iterator that automatically follows OData nextLink pages) and `TrackerSet` (a dictionary subclass that tracks attribute changes for efficient PATCH updates). These patterns are reusable across any REST API client that needs pagination and change tracking.
Defines a `BaseTokenBackend` abstract class and multiple concrete implementations (`FileSystemTokenBackend`, `MemoryTokenBackend`, `EnvTokenBackend`, `FirestoreBackend`, `AWSS3Backend`, `AWSSecretsBackend`, `BitwardenSecretsManagerBackend`, `DjangoTokenBackend`) for storing OAuth tokens. The backend pattern is cleanly separated and can be reused in any Python application requiring secure, configurable token persistence with optional encryption.
Implements a fluent `QueryBuilder` class for constructing OData `$filter`, `$select`, `$orderby`, `$expand`, and `$search` parameters. Uses composable filter classes (`QueryFilter`, `CompositeFilter`, `OrderByFilter`) that can be chained or combined with logical operators. This is a reusable pattern for any client that needs to build complex OData or REST query strings programmatically.
Provides `AttachableMixin`, `BaseAttachment`, and `BaseAttachments` classes for handling file and item attachments. Includes `UploadSessionRequest` for large file uploads using Microsoft Graph's resumable upload session protocol (chunked upload with automatic URL construction and progress tracking). The mixin pattern and upload logic can be reused in other SDKs that need to attach files or perform chunked uploads.
Contains a static mapping dictionary converting Windows timezone names (e.g., 'Pacific Standard Time') to IANA timezone names (e.g., 'America/Los_Angeles'). This is essential for interpreting timestamps from Microsoft Graph, which returns timezones in Windows format. The mapping is comprehensive and can be reused in any Python project that needs to convert between Windows and IANA timezones.