Skip to main content

Asynchronous Python scraper for Celcat Calendar

Project description

Celcat Calendar Scraper

An asynchronous Python library for scraping Celcat calendar systems.

Installation

pip install celcat-scraper

Usage

Basic example of retrieving calendar events:

import asyncio
from datetime import datetime, timedelta
from celcat_scraper import CelcatConfig, CelcatScraperAsync

async def main():
    # Configure the scraper
    config = CelcatConfig(
        url="https://celcat.university.com",
        username="your_username",
        password="your_password",
        include_holidays=True
    )

    # Create scraper instance and get events
    async with CelcatScraperAsync(config) as scraper:

        start_date = datetime.now()
        end_date = start_date + timedelta(days=30)
        
        # Recommended to store events locally and reduce the amout of requests
        file_path = 'store.json'
        events = scraper.deserialize_events(file_path)
        
        events = await scraper.get_calendar_events(start_date, end_date, previous_events=events)
        
        for event in events:
            print(f"Event {event['id']}")
            print(f"Course: {event['category']} - {event['course']}")
            print(f"Time: {event['start']} to {event['end']}")
            print(f"Location: {', '.join(event['rooms'])} at {', '.join(event['sites'])} - {event['department']}")
            print(f"Professors: {', '.join(event['professors'])}")
            print("---")
        
        # Save events for a future refresh
        scraper.serialize_events(events, file_path)

if __name__ == "__main__":
    asyncio.run(main())

Features

  • Async/await support for better performance
  • Rate limiting with adaptive backoff
  • Optional caching support
  • Automatic session management
  • Batch processing of events
  • Error handling and retries

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

celcat_scraper-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

celcat_scraper-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file celcat_scraper-0.1.0.tar.gz.

File metadata

  • Download URL: celcat_scraper-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for celcat_scraper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7b15e3dda3cb1e7df664b8d2777f8323e00416399f2080100965deb41adc7fbe
MD5 078b70d49483ccda883a4aaba7eec771
BLAKE2b-256 7ccc1cd90ab2f0830cca2de60414e68b1e364e8763ff8099b878921b7d464a13

See more details on using hashes here.

File details

Details for the file celcat_scraper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: celcat_scraper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for celcat_scraper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d84eb9e36486d529cc890b5328a1e931e61cf487d7c806c8e3e1f44ec93e7dee
MD5 417cf21d751168609e8e3771f42719a4
BLAKE2b-256 f2c13310747956785529714c4419b30f3d281b881cfebc229516d49b47900f5f

See more details on using hashes here.

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