up osm cal extractor
This commit is contained in:
parent
8613d218cd
commit
6df72c46b8
2 changed files with 15 additions and 3 deletions
|
@ -6,6 +6,15 @@ This script fetches events from the OpenStreetMap Calendar RSS feed
|
|||
and adds them to the OpenEventDatabase if they don't already exist.
|
||||
|
||||
RSS Feed URL: https://osmcal.org/events.rss
|
||||
|
||||
Environment Variables:
|
||||
DB_NAME: The name of the database (default: "oedb")
|
||||
DB_HOST: The hostname of the database server (default: "localhost")
|
||||
DB_USER: The username to connect to the database (default: "")
|
||||
POSTGRES_PASSWORD: The password to connect to the database (default: None)
|
||||
|
||||
These environment variables can be set in the system environment or in a .env file
|
||||
in the project root directory.
|
||||
"""
|
||||
|
||||
import json
|
||||
|
@ -20,7 +29,7 @@ from datetime import datetime, timedelta
|
|||
# Add the parent directory to the path so we can import from oedb
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
|
||||
from oedb.utils.db import db_connect
|
||||
from oedb.utils.db import db_connect, load_env_from_file
|
||||
from oedb.utils.logging import logger
|
||||
|
||||
# RSS Feed URL for OSM Calendar
|
||||
|
@ -407,6 +416,9 @@ def main():
|
|||
Main function to fetch OSM Calendar events and add them to the database.
|
||||
"""
|
||||
logger.info("Starting OSM Calendar extractor")
|
||||
|
||||
# Load environment variables from .env file if it exists
|
||||
load_env_from_file()
|
||||
|
||||
# Fetch events from the OSM Calendar RSS feed
|
||||
items = fetch_osm_calendar_data()
|
||||
|
|
|
@ -5,7 +5,7 @@ SNCF Travaux Extractor for the OpenEventDatabase.
|
|||
This script fetches railway work schedules from the SNCF open data API
|
||||
and adds them to the OpenEventDatabase.
|
||||
|
||||
API URL: https://data.sncf.com/api/explore/v2.1/catalog/datasets/interceptions-programmees-sur-ligne/records?limit=200
|
||||
API URL: https://data.sncf.com/api/explore/v2.1/catalog/datasets/interceptions-programmees-sur-ligne/records?limit=100
|
||||
|
||||
Example data format:
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ from oedb.utils.db import db_connect
|
|||
from oedb.utils.logging import logger
|
||||
|
||||
# API URL for SNCF open data
|
||||
API_URL = "https://data.sncf.com/api/explore/v2.1/catalog/datasets/interceptions-programmees-sur-ligne/records?limit=200"
|
||||
API_URL = "https://data.sncf.com/api/explore/v2.1/catalog/datasets/interceptions-programmees-sur-ligne/records?limit=100"
|
||||
|
||||
def fetch_sncf_data():
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue