Code Monkey home page Code Monkey logo

untis-rs's People

Contributors

arnim279 avatar faunkr avatar luleyleo avatar luro02 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

untis-rs's Issues

Can't be build anymore because of yanked crate

I would love to use this libary in a project but it can't be build anymore, because the crate reqwest needs native-tls, which requires a yanked version of secruity-framework

Heres my full error:

error: failed to select a version for the requirement `security-framework = "^0.1.13"`
candidate versions found which didn't match: 2.8.2, 2.8.1, 2.8.0, ...
location searched: crates.io index
required by package `native-tls v0.1.3`
    ... which satisfies dependency `native-tls = "^0.1.3"` of package `reqwest v0.8.5`
    ... which satisfies dependency `reqwest = "^0.8.5"` of package `untis v0.2.1`
    ... which satisfies dependency `untis = "^0.2.1"` of package `untis-rust-test v0.1.0 (/home/alex/dev/untis-rust-test)`

Serde error: data did not match any variant of untagged enum Response

When I log in, serde thorws the error "data did not match any variant of untagged enum Response"

thread 'main' panicked at src/main.rs:4:62:
called `Result::unwrap()` on an `Err` value: Serde(Error("data did not match any variant of untagged enum Response", line: 0, column: 0))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Serde Serialize fails, when using a too old date

We use Webuntis in our school and we can only view 2 weeks in the future and 1 week in the past. Going past the 1 week limit gives me the following exception:

thread 'main' panicked at 'Failed to get timetable: SerdeJSON(Error("missing field `result`", line: 1, column: 78))', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Here is the full backtrace:

thread 'main' panicked at 'Failed to get timetable: SerdeJSON(Error("missing field `result`", line: 1, column: 78))', src/libcore/result.rs:997:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:70
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:58
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:385
   6: rust_begin_unwind
             at src/libstd/panicking.rs:312
   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   8: core::result::unwrap_failed
             at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libcore/macros.rs:16
   9: <core::result::Result<T, E>>::expect
             at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libcore/result.rs:825
  10: mcuntis::main
             at src/main.rs:16
  11: std::rt::lang_start::{{closure}}
             at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libstd/rt.rs:64
  12: std::panicking::try::do_call
             at src/libstd/rt.rs:49
             at src/libstd/panicking.rs:297
  13: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:92
  14: std::rt::lang_start_internal
             at src/libstd/panicking.rs:276
             at src/libstd/panic.rs:388
             at src/libstd/rt.rs:48
  15: std::rt::lang_start
             at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libstd/rt.rs:64
  16: main
  17: __libc_start_main
  18: _start

I requested the timetable and the following is my code (username and stuff has been removed ๐Ÿ˜ )

type Result<T> = std::result::Result<T, std::io::Error>;
use untis::{ Units };
use chrono::{ Local, Utc, NaiveDate };

fn main() -> Result<()> {
    let mut untis = Units::new("nete", "", "", "");
    // let today = Local::today().naive_local();
    let today = NaiveDate::from_ymd(2019, 02, 10);
    let info = untis.login().expect("Failed to login");

    let _statusdata  = untis.status_data()                      .expect("Failed to get status data" );
    let _holidays    = untis.holidays()                         .expect("Failed to get holidays"    );
    let _rooms       = untis.rooms()                            .expect("Failed to get rooms"       );
    let _classes     = untis.classes()                          .expect("Failed to get classes"     );
    let _subjects    = untis.subjects()                         .expect("Failed to get subjects"    );
    let _timetable   = untis.timetable(info.class_id, 1, today) .expect("Failed to get timetable"   );
    let _departments = untis.departments()                      .expect("Failed to get departments" );
    // teachers
    println!("_timetable {:#?}", _timetable);
    println!("{:#?}", info.class_id);
    println!("{:#?}", info);
    untis.logout().expect("Failed to logout");
    Ok(())
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.