This project is a script that uses the following "Nextcloud Calender Manage API"
https://github.com/murajo/nextcloud-calender-manage-api
It contains a Python script that checks for an SSL certificate for the specified domain and automatically adds the event to the NextCloud calendar if not present.
Need "Nextcloud Calender Manage API" running and able to connect.
https://github.com/murajo/nextcloud-calender-manage-api
-
Install the required packages.
pip install -r requirements.txt
-
Create a
config.yamlfile in the root directory with the following structure:domains: - example.com - anotherdomain.com nextcloud: api_url: "http://<your-nextcloud-calendar-manage-api-url>:<port>" calendar_name: "<your-calendar-name>"
-
Running the Script
python main.py
-
Build the Docker image:
docker build -t ssl-certificate-add-to-calendar . -
Create a
config.yamlfile in an arbitrary directory with the following structure:domains: - example.com - anotherdomain.com nextcloud: api_url: "http://<your-nextcloud-calendar-manage-api-url>:<port>" calendar_name: "<your-calendar-name>"
-
Run the Docker container:
docker run -v /path/to/your/config.yaml:/app/config.yaml ssl-certificate-add-to-calendar
- Function:
get_ssl_info(host, port=443) - Description: Retrieves SSL certificate information for the specified host.
- Parameters:
host: Domain to check.port: Port (default is 443).
- Returns: A dictionary with the common name and validity dates of the SSL certificate, or
Noneif an error occurs.
- Function:
check_event_exists(calendar_name, summary) - Description: Checks if a specific event exists in the NextCloud calendar.
- Parameters:
calendar_name: Name of the calendar.summary: Event summary.
- Returns:
Trueif the event exists; otherwise,False.
- Function:
create_event(calendar_name, start_time, end_time, summary, description, timezone="Asia/Tokyo") - Description: Adds a new event to the specified calendar.
- Parameters:
calendar_name: Name of the calendar.start_time: Event start time.end_time: Event end time.summary: Event summary.description: Event description.timezone: Timezone for the event (default is "Asia/Tokyo").
- Returns: Outputs the response status after adding the event.