luleyleo / untis-rs Goto Github PK
View Code? Open in Web Editor NEWRust library to access the webuntis jsonrpc
License: MIT License
Rust library to access the webuntis jsonrpc
License: MIT License
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)`
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
https://rust-lang-nursery.github.io/api-guidelines/interoperability.html
You can derive most of them (Serialize and Deserialize are from Serde):
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Serialize, Deserialize)]
Only Display has to be implemented manually
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(())
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.