Metadata-Version: 2.4
Name: osm-sdk
Version: 0.1.0.dev1
Summary: A Python SDK for Online Scout Manager (OSM)
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: email-validator>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: respx>=0.21.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: build>=1.2.2; extra == "dev"
Dynamic: license-file

# OSM SDK

OSM SDK is a Python SDK for Online Scout Manager (OSM).

The project is provided as a PyPI package that is published on [pypi.org](https://pypi.org/project/osm-sdk/), and it can be installed by running:

```bash
pip install osm-sdk
```

## Requirements

OSM SDK requires an OAuth Client ID and Oauth Secret.

These can be generated within OSM, by going to Settings → My Account Details → Developer Tools → Create Application.

Client Credentials Grant must be enabled for the application.

## Quick Start

```python
from osm_sdk import OSMClient, OSMAttendanceStatus

client = OSMClient(client_id="...", client_secret="...")

section = client.get_section(name="Scouts")
term = section.current_term()

for member in term.list_members():
    contacts = member.list_contacts()
    print(f"Member: {member.full_name} has {len(contacts)} contacts.")

for event in term.list_events():
    attendance = event.list_attendance()
    attending = [a for a in attendance if a.status == OSMAttendanceStatus.YES]
    print(f"Event: {event.name}: {len(attending)} attending (out of {len(attendance)})")

for meeting in term.list_meetings():
    attendance = meeting.list_attendance()
    attending = [a for a in attendance if a.status == OSMAttendanceStatus.YES]
    print(f"Meeting: {meeting.name}: {len(attending)} attending (out of {len(attendance)})")
```

By default, `OSMClient` requests the scopes:
`section:member:read section:event:read section:programme:read section:attendance:read`.

## Documentation

The public API is documented in [PUBLIC_API.md](PUBLIC_API.md).

## Contributions

Contributions are welcome! Read the [contributing guide](CONTRIBUTING.md) to get started.

## License

This project is licensed under the [MIT License](LICENSE).
