#sis #moodle #api-bindings #action #eelu-sis-moodle #eelu-sis-login #eelu-sis

sis-login

A simple crate to login to SIS system and perform the various actions e.x. (getting the moodle session link) without the need to open the browser

12 releases

0.3.1 Dec 17, 2023
0.3.0 Nov 12, 2023
0.2.8 Oct 7, 2023
0.2.6 Aug 22, 2023
0.1.0 Apr 8, 2023

#7 in #moodle

Download history 7/week @ 2024-07-28 206/week @ 2024-09-29

206 downloads per month
Used in eelu-login

MIT/Apache

26KB
272 lines

Lqth logo

A library to login to the sis system and get the moodle session

crates.io docs.rs downloads license

Example

use sis_login::Sis;
use sis_login::sis::types::user_type::UserType;

#[tokio::main]
async fn main() {
   let username = std::env::var("SIS_USERNAME").unwrap();
   let password = std::env::var("SIS_PASSWORD").unwrap();

   // Crate Sis instance
   let headers_builder = sis_login::headers_builder::DefaultHeadersBuilder::new(
      "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0".to_string(),
     "https://sis.eelu.edu.eg/static/PortalStudent.html".to_string()
  );

   let login_url: &str = "https://sis.eelu.edu.eg/studentLogin";
   let get_moodle_session_url: &str = "https://sis.eelu.edu.eg/getJCI";
   let mut sis = Sis::new(login_url, get_moodle_session_url, &headers_builder);

  // Login to sis
   match sis.login(&username, &password, UserType::Student).await {
        Ok(_) => {
            println!("Login Success");
           // Get moodle session link
          let Ok(moodle_session_link) = sis.get_moodle_session_link().await else { panic!("Failed to get moodle session link") };
          println!("Moodle session link: {}", moodle_session_link);
       },
        Err(err) => println!("Login Failed: {}", err),
    }
}

Features

  • debug - Enable debug logs, you still need to use a logger like env_logger and initialize it in your code

Contributing

I'm happy to accept any contributions, just consider reading the CONTRIBUTING.md guide first. to avoid waste waste our time on some unnecessary things.

the main keywords are: signed commits, conventional commits, no emojis, linear history, the PR shouldn't have more than tree commits most of the time

License

This project is licensed under MIT license.

Dependencies graph

deps graph

Generated with cargo-depgraph

Current version: 0.3.0

Dependencies

~13–26MB
~487K SLoC