Skip to main content

UDOM Ratiba API

Overview

This project is designed to scrape data from the ratiba.udom.ac.tz website, which provides information about the academic schedules of the University of Dodoma in Tanzania. The scraped data includes the schedules of courses and other academic activities offered by the university.

The main purpose of this project is to provide users with a convenient way of accessing the university's academic schedule information by providing the scraped data in a structured format that can be easily parsed and analyzed.

Dependencies

This project requires the following dependencies to be installed:

  • Python 3.x
  • Beautiful Soup 4
  • Requests

Installation

To install the project, follow these steps:

  1. To get the latest version run,
pip install udomratibaapi

Usage

Here is a list of all the functions provided and example usage for each

Get Semesters

Function that returns all the semesters displayed in the ratiba website

This function accepts a dictionary of current academic year as a parameter and returns a list of dictionaries for each semester

from udomratibaapi import ratiba, utils
import json

academic_year = utils.get_current_academic_year()
semesters = ratiba.get_semesters(academic_year)

# display the semesters
print(json.dumps(semesters, indent=2))

Get Timetable Categories

Function that returns all the timetable categories from the site. Possible values include Teaching or Test timetables

This function accepts a dictionary of current academic year and a dictionary of semester

from udomratibaapi import ratiba, utils
import json

academic_year = utils.get_current_academic_year()
semesters = ratiba.get_semesters(academic_year)

# pic one semester from the array
semester_two = semesters[2]
categories = ratiba.get_categories(academic_year, semester_two)

# display the categories
print(json.dumps(categories, indent=2))

Get Download Options

Returns all the download options from the site. Possible values include Venue, Course, Programme and Instructor

This function accepts a dictionary of current academic year, semester of choice and category of choice

from udomratibaapi import ratiba, utils
import json

academic_year = utils.get_current_academic_year()
semesters = ratiba.get_semesters(academic_year)

# pick one semester from the array
semester_two = semesters[2]
categories = ratiba.get_categories(academic_year, semester_two)

# pick one category, say Teaching
category = categories[0]

options = ratiba.get_download_options(academic_year, semester_two, category)

# display the options
print(json.dumps(options, indent=2))

Get Option Data

This function gets the chioces for the specific option selected. Suppose you select venue in options, it will return a list of all venues present in the site

It accepts all the parameters of the Get Download Options function with an added one which is a dictionary of a particular option

from udomratibaapi import ratiba, utils
import json

academic_year = utils.get_current_academic_year()
semesters = ratiba.get_semesters(academic_year)

# pick one semester from the array
semester_two = semesters[2]
categories = ratiba.get_categories(academic_year, semester_two)

# pick one category, say Teaching
category = categories[0]

options = ratiba.get_download_options(academic_year, semester_two, category)

# pick one option from the list of options (venues)
# for option: 0 - venue, 1 - course, 2 - programme, 3 - instructor
venue_option = options[0]
venues_list = ratiba.get_data(academic_year, semester, category, venue_option)

# display the option data (list of all venues)
print(json.dumps(venues_list, indent=2))

Get Timetable

Finally combine all the data and choices from previous functions to get the whole timetable data based on your choices

from udomratibaapi import ratiba, utils
import json

academic_year = utils.get_current_academic_year()
semesters = ratiba.get_semesters(academic_year)

# pick one semester from the array
semester_two = semesters[2]
categories = ratiba.get_categories(academic_year, semester_two)

# pick one category, say Teaching
category = categories[0]

options = ratiba.get_download_options(academic_year, semester_two, category)

# pick one option from the list of options (venues)
# for option: 0 - venue, 1 - course, 2 - programme, 3 - instructor
venue_option = options[0]
venues_list = ratiba.get_data(academic_year, semester_two, category, venue_option)

# select one specific venue
# LRB 106 is a venue from CIVE, UDOM and has an id of 3688
lrb_106 = [v for v in venues_list if v['id'] == "3688"][0]

# get timetable for the choose venue
timetable = ratiba.get_timetable(academic_year, semester_two, category, venue_option, lrb_106)

# display the timetable
print(json.dumps(timetable, indent=2))

Its important to go through UDOM Ratiba site carefully to understand these functions

Contribution

If you would like to contribute to this project, please fork the repository and submit a pull request with your changes.

Credits

This project was created by VincentLaizer.

License

This project is licensed under the MIT license.

Release files for udomratibaapi 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for udomratibaapi 0.0.1
File Size Uploaded
udomratibaapi-0.0.1.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for udomratibaapi 0.0.1
File Interpreter ABI Platform
udomratibaapi-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / udomratibaapi-0.0.1.tar.gz

Download URL udomratibaapi-0.0.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5ea2eb9175efa9543e2c7080ca413b5acbac6712bc705626a090eb8143a97119
BLAKE2b-256 checksum
How to use checksums
962ae0d39799be04d73f6b8e539e784f433ff476de83580444d5f8e9d3f07fed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / udomratibaapi-0.0.1-py3-none-any.whl

Download URL udomratibaapi-0.0.1-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d917f43f130e060633c6fd79dffed4d56689da3a5f8628ab11b35cc3e9ba4141
BLAKE2b-256 checksum
How to use checksums
fc4d8b2fef14100a3c45f509ea86e815219b72a3997806f4770691893cb97b20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page