Skip to content

Conversation

@tobixen
Copy link
Member

@tobixen tobixen commented Dec 9, 2025

Update examples to use get_davclient() instead of DAVClient()

- Identified 10 API inconsistencies in davclient.py
- Researched URL parameter usage patterns
- Found HTTP method wrappers are essential (dynamic dispatch in _query)
- Split URL requirements: optional for query methods, required for resource methods
- Standardize on 'body' parameter name for dynamic dispatch compatibility
- principals() should be renamed search_principals() in async API
- get_davclient() already recommended in all documentation
- Supports env vars, config files (12-factor app)
- TODO comment already suggests deprecating direct DAVClient()
- Propose making get_davclient() primary for both sync and async
- Async: aio.get_client() or aio.get_davclient() or aio.connect()
…pers

User insight: _query() could call request() directly instead of using dynamic dispatch

Three options analyzed:
1. Eliminate wrappers entirely (breaking change)
2. Method registry pattern (breaking change)
3. Keep wrappers, remove dependency (recommended)

Recommendation: Option 3 - refactor _query() to use request() directly,
but keep method wrappers as thin public convenience API for discoverability
and backward compatibility
- Reject 'connect()' naming - no actual connection in __init__
- Propose optional probe parameter for get_davclient()
- OPTIONS request to verify server reachable
- probe=False for sync (backward compat), probe=True for async (fail fast)
- Opt-out available for testing
Changed 5 example files to use the recommended get_davclient() factory function:
- examples/scheduling_examples.py
- examples/google-flask.py
- examples/google-django.py
- examples/google-service-account.py
- examples/example_rfc6764_usage.py

This aligns examples with the official documentation which already
recommends get_davclient() throughout.
@tobixen
Copy link
Member Author

tobixen commented Dec 9, 2025

Wrong branch possibly

@tobixen tobixen closed this Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants