Package: udomratibaapi
UDOM Ratiba APIOverviewThis project is designed to scrape data from theratiba.udom.ac.tzwebsite, 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.DependenciesThis project requires the following dependencies to be installed:Python 3.xBeautiful Soup 4RequestsInstallationTo install the project, follow these steps:To get the latest version run,pip install udomratibaapiUsageHere is a list of all the functions provided and example usage for eachGet SemestersFunction that returns all the semesters displayed in the ratiba websiteThis function accepts a dictionary of current academic year as a parameter and returns a list of dictionaries for each semesterfromudomratibaapiimportratiba,utilsimportjsonacademic_year=utils.get_current_academic_year()semesters=ratiba.get_semesters(academic_year)# display the semestersprint(json.dumps(semesters,indent=2))Get Timetable CategoriesFunction that returns all the timetable categories from the site. Possible values includeTeachingorTesttimetablesThis function accepts a dictionary of current academic year and a dictionary of semesterfromudomratibaapiimportratiba,utilsimportjsonacademic_year=utils.get_current_academic_year()semesters=ratiba.get_semesters(academic_year)# pic one semester from the arraysemester_two=semesters[2]categories=ratiba.get_categories(academic_year,semester_two)# display the categoriesprint(json.dumps(categories,indent=2))Get Download OptionsReturns all the download options from the site. Possible values includeVenue,Course,ProgrammeandInstructorThis function accepts a dictionary of current academic year, semester of choice and category of choicefromudomratibaapiimportratiba,utilsimportjsonacademic_year=utils.get_current_academic_year()semesters=ratiba.get_semesters(academic_year)# pick one semester from the arraysemester_two=semesters[2]categories=ratiba.get_categories(academic_year,semester_two)# pick one category, say Teachingcategory=categories[0]options=ratiba.get_download_options(academic_year,semester_two,category)# display the optionsprint(json.dumps(options,indent=2))Get Option DataThis 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 siteIt accepts all the parameters of theGet Download Optionsfunction with an added one which is a dictionary of a particular optionfromudomratibaapiimportratiba,utilsimportjsonacademic_year=utils.get_current_academic_year()semesters=ratiba.get_semesters(academic_year)# pick one semester from the arraysemester_two=semesters[2]categories=ratiba.get_categories(academic_year,semester_two)# pick one category, say Teachingcategory=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 - instructorvenue_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 TimetableFinally combine all the data and choices from previous functions to get the whole timetable data based on your choicesfromudomratibaapiimportratiba,utilsimportjsonacademic_year=utils.get_current_academic_year()semesters=ratiba.get_semesters(academic_year)# pick one semester from the arraysemester_two=semesters[2]categories=ratiba.get_categories(academic_year,semester_two)# pick one category, say Teachingcategory=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 - instructorvenue_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 3688lrb_106=[vforvinvenues_listifv['id']=="3688"][0]# get timetable for the choose venuetimetable=ratiba.get_timetable(academic_year,semester_two,category,venue_option,lrb_106)# display the timetableprint(json.dumps(timetable,indent=2))Its important to go throughUDOM Ratiba sitecarefully to understand these functionsContributionIf you would like to contribute to this project, please fork the repository and submit a pull request with your changes.CreditsThis project was created byVincentLaizer.LicenseThis project is licensed under theMITlicense.