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 date, timedelta
from celcat_scraper import CelcatConfig, CelcatScraperAsync
async def main():
# Configure the scraper
config = CelcatConfig(
url="https://university.com/calendar",
username="your_username",
password="your_password",
include_holidays=True
)
# Create scraper instance and get events
async with CelcatScraperAsync(config) as scraper:
start_date = date.today()
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
- Optional reusable aiohttp session
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file celcat_scraper-1.0.0.tar.gz.
File metadata
- Download URL: celcat_scraper-1.0.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6369f589ce9afbc74f0317c2172a003740c59a8cefa98df07a69e55e711e99f9
|
|
| MD5 |
f48aad12fc9ae226cc87292837530c85
|
|
| BLAKE2b-256 |
42a2589cea783afc7f360d667873a5eece4f6138a73cbb6b54fd8f541bb414c0
|
Provenance
The following attestation bundles were made for celcat_scraper-1.0.0.tar.gz:
Publisher:
python-publish.yml on etiennec78/celcat-scraper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
celcat_scraper-1.0.0.tar.gz -
Subject digest:
6369f589ce9afbc74f0317c2172a003740c59a8cefa98df07a69e55e711e99f9 - Sigstore transparency entry: 175736908
- Sigstore integration time:
-
Permalink:
etiennec78/celcat-scraper@c0f699a0644490f2b632e2eeb7b8c42c95939e01 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/etiennec78
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c0f699a0644490f2b632e2eeb7b8c42c95939e01 -
Trigger Event:
release
-
Statement type:
File details
Details for the file celcat_scraper-1.0.0-py3-none-any.whl.
File metadata
- Download URL: celcat_scraper-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7beb9e8c75d8b4fe55e600787a828e9a8c8ca9f71699db717c8dc0bbab75a8c5
|
|
| MD5 |
4712c6bb82f1051e9203c899f2d1e587
|
|
| BLAKE2b-256 |
8b18d046fd587a2e6062e706bf0c7df80335c7669d9e7478e35b00032e7a3a80
|
Provenance
The following attestation bundles were made for celcat_scraper-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on etiennec78/celcat-scraper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
celcat_scraper-1.0.0-py3-none-any.whl -
Subject digest:
7beb9e8c75d8b4fe55e600787a828e9a8c8ca9f71699db717c8dc0bbab75a8c5 - Sigstore transparency entry: 175736909
- Sigstore integration time:
-
Permalink:
etiennec78/celcat-scraper@c0f699a0644490f2b632e2eeb7b8c42c95939e01 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/etiennec78
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c0f699a0644490f2b632e2eeb7b8c42c95939e01 -
Trigger Event:
release
-
Statement type: