Skip to main content

Local calendar caching and JSON API

Project description

📅 jcalapi

jcalapi is a local calendar cache and JSON API that interacts with Exchange and Confluence calendars. It fetches events and returns them in a JSON format, making it easy to integrate calendar data into other systems.

🚀 Getting Started

📋 Prerequisites

  • Python
  • uv (or Nix with flakes)

🔑 Setting Up Credentials

To use jcalapi, you'll need to provide credentials for accessing your Exchange or Confluence calendars. These credentials should be stored in a secure location, and you should ensure that they are not exposed in your code or version control system.

For Exchange, you'll need your username and password. For Confluence, you'll need your API token.

See .envrc-sample for an example.

💾 Installation

# pip
pip install --user jcalapi

# pipx
pipx install jcalapi

🏃 Usage

You can run the application directly using Python:

python -m jcalapi

🐳 Blablabla, Docker?

docker run -it --rm -p 127.0.0.1:7042:7042 \
  -e ONFLUENCE_URL=https://confluence.example.com \
  -e CONFLUENCE_USERNAME=john.doe \
  -e CONFLUENCE_PASSWORD=XXX \
  -e EXCHANGE_USERNAME=john.doe@example.com \
  -e EXCHANGE_PASSWORD=XXX \
  -e GOOGLE_CREDENTIALS=/config/xxx.apps.googleusercontent.com.json \
  -e GOOGLE_CALENDAR_REGEX='^Work '
  ghcr.io/pschmitt/jcalapi

📚 API Usage

The API provides endpoints for fetching calendar events. Here's an example of how to use it:

curl http://localhost:7042/today

This will return a JSON response with the events data:

[
  {
    "uid": "event1",
    "backend": "exchange",
    "calendar": "calendar1",
    "organizer": "organizer1",
    "attendees": {
      "name": "hisname",
      "email": "his@email.com",
      "optional": false,
      "response": "Accept"
    },
    "summary": "event1 summary",
    "description": "event1 description",
    "body": "event1 body",
    "location": "event1 location",
    "start": "2023-06-06T00:00:00",
    "end": "2023-06-06T01:00:00",
    "whole_day": false,
    "is_recurring": false,
    "categories": [
      "Cat1",
      "Cat2"
    ],
    "status": "confirmed",
    "extra": {
      "conference_type": "Teams",
      "meeting_workspace_url": "https://teams.microsoft.com/l/meetup-join/...",
      "net_show_url": "https://teams.microsoft.com/l/meetup-join/..."
    },
    "conference_url": "https://teams.microsoft.com/l/meetup-join/..."
  },
  ...
]

To fetch events for tomorrow, you can use the /tomorrow endpoint:

curl http://localhost:7042/tomorrow

This will return a JSON response with the events data for tomorrow.

The /meta endpoint provides metadata about the backends (Confluence/Exchange):

curl http://localhost:7042/meta

The /reload endpoint allows you to reload the calendar data:

curl -X POST http://localhost:7042/reload

🤝 Contributing

Contributions are welcome! Please feel free to submit a pull request.

🧑‍💻 Development setup

  1. Clone the repository
git clone https://github.com/pschmitt/jcalapi.git
  1. Navigate into the cloned repository
cd jcalapi
  1. Setup the environment
uv sync --group dev  # with Nix devshell, dev tools are already available

Alternatives:

  • Use Nix flakes: nix develop drops you into a shell with dev tools and uv; run uv sync --group dev to install deps locally and uv run python -m jcalapi

📄 License

This project is licensed under the GNU General Public License v3.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jcalapi-0.2.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jcalapi-0.2.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file jcalapi-0.2.0.tar.gz.

File metadata

  • Download URL: jcalapi-0.2.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jcalapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d9c0839ea41657c0db26b551c09873edc4874b894b247c65d93f86afcc46c254
MD5 e237fa0a997136cb3a32224707ff71e4
BLAKE2b-256 0a65ec485579d7c6f5372d96606020a9ea6220ac52b7f6ff81800979ceb60527

See more details on using hashes here.

Provenance

The following attestation bundles were made for jcalapi-0.2.0.tar.gz:

Publisher: release.yaml on pschmitt/jcalapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jcalapi-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: jcalapi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jcalapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84d2a7cff4b75e799c601098f48d961ca1f0bf68832e116bf6def7d2ced1faf4
MD5 e6b216c0732148dd75b873307f3ea931
BLAKE2b-256 c3902d0a73cda370d93e5c0b607dad9a5f4357779fba14664600631a1eda3fc8

See more details on using hashes here.

Provenance

The following attestation bundles were made for jcalapi-0.2.0-py3-none-any.whl:

Publisher: release.yaml on pschmitt/jcalapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page