Skip to main content

Fetch data from the UDOM ratiba website in a clean JSON format

Project description

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.

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

udomratibaapi-0.0.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

udomratibaapi-0.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file udomratibaapi-0.0.1.tar.gz.

File metadata

  • Download URL: udomratibaapi-0.0.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for udomratibaapi-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5ea2eb9175efa9543e2c7080ca413b5acbac6712bc705626a090eb8143a97119
MD5 ef410011f74d88bf05940b4157eb68a5
BLAKE2b-256 962ae0d39799be04d73f6b8e539e784f433ff476de83580444d5f8e9d3f07fed

See more details on using hashes here.

File details

Details for the file udomratibaapi-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: udomratibaapi-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for udomratibaapi-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d917f43f130e060633c6fd79dffed4d56689da3a5f8628ab11b35cc3e9ba4141
MD5 9567fc669722824523de10b8b4e19623
BLAKE2b-256 fc4d8b2fef14100a3c45f509ea86e815219b72a3997806f4770691893cb97b20

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