Installation
pip install fenix_api_sdk
Configuration
Create a configurations file in your application project root:
- Copy file fenixedu.sample.ini to a new one called fenixedu.ini
cp fenixedu.sample.ini fenixedu.ini
- Move it to your project's root
mv fenixedu.ini project_dir
- Edit fenixedu.ini file according to your app info
Usage:
- Import python sdk
import fenix
- Instatiate an API object in your source code
api = fenix.FenixAPISingleton()
- Get the authentication url
url = api.get_authentication_url()
- Redirect your user to that url
- It will redirect the user to a url like:
redirect_uri?code=[code]
- Get the code parameter in url and do:
api.set_code(code)
- It will request an access token and returns no erros if everything is fine
- Start using the api like this:
person = api.get_person()
Available methods
[x] - Optional parameters
- All endpoint in FenixEdu API have a method in this sdk
- Mapping between FenixAPISingleton api methods and original api endpoints
API endpoint -> SDK FenixAPISingleton Methods
- Public methods
GET /about ->
get_about
GET /courses/{id} ->
get_course(id)
GET /courses/{id}/evaluations ->
get_course_evaluations(id)
GET /courses/{id}/groups ->
get_course_groups(id)
GET /courses/{id}/schedule ->
get_course_schedule(id)
GET /courses/{id}/students ->
get_course_students(id)
GET /degrees ->
get_degrees([year])
GET /degrees/{id} ->
get_degree(id, [year])
GET /degrees/{id}/courses ->
get_degree_courses(id, [year])
GET /spaces ->
get_spaces()
GET /spaces/{id} ->
get_space(id,[day])
- Private methods (You need to get an access token before calling one of this methods)
GET /person ->
get_person()
GET /person/calendar/classes ->
get_classes_calendar()
GET /person/calendar/evaluations ->
get_evaluations_calendar()
GET /person/courses ->
get_courses([sem], [year])
GET /person/evaluations ->
get_evaluations()
GET /person/payments ->
get_payments()
PUT /person/evaluations/{id} ->
enrol_in_evaluation(id, [enrol_action])
More info about all available endpoints in FenixEdu API website