Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

Module for scraping UC Merced's class schedules

Project description

# UCMercedule: Scraper
A Python module that scrapes [UC Merced class schedules][1] for you!

Just create a `Schedule` object with `ucmscraper.Schedule(validterm)`, where `validterm` is a value from the eponymous radio button group found in the [UC Merced Schedule Search form][1]. Call `ucmscraper.fetchValidterms()` to get the current `validterm`s, or inspect the search page's raw source HTML.

## Installation
pip install ucmscraper

## Example usage
import json
import pathlib # Python 3.5+; for pre3.5 Python, import pathlib2
import ucmscraper


# Fall Semester 2018
# schedule = ucmscraper.Schedule(201830)

validterms = ucmscraper.fetchValidterms()
schedule = ucmscraper.Schedule(validterms[-1]) # latest term

with open('example/Fall_2018_Schedule.html', 'wb') as f:
with open('example/Fall_2018_Departments.json', 'w') as f:
json.dump(schedule.departments, f, sort_keys=True, indent=4)
with open('example/Fall_2018_Sections.json', 'w') as f:
json.dump(schedule.sections, f, sort_keys=True, indent=4)
Check out the resulting schedule files in the [example folder](example/).


Project details

Download files

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

Files for ucmscraper, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size ucmscraper-1.1.0-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ucmscraper-1.1.0.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page