Skip to content

Error: Rpc(Error { code: -7004, message: "no allowed date" }) #14

@maxbossing

Description

@maxbossing

With this code:

fn main() -> Result<(), untis::Error> {
    // Get the school by its id.
    let school = untis::schools::get_by_id(&[redacted])?;

    // Log in with your credentials. The school's details are filled in automatically.
    let result = school.client_login(
        "[redacted]",
        "[redacted]",
    );
    let mut client: untis::Client;

    // Match the result to handle specific error cases.
    match result {
        Ok(v) => client = v,
        Err(untis::Error::Rpc(err)) => {
            if err.code == untis::jsonrpc::ErrorCode::InvalidCredentials.as_isize() {
                println!("Invalid credentials");
            }
            return Err(untis::Error::Rpc(err));
        }
        Err(err) => return Err(err)?,
    };

    println!("hehe");
    let date = chrono::Local::now().date_naive() + chrono::Duration::weeks(2);

    // Get the client's own timetable until 2 weeks from now.
    let timetable = client.own_timetable_for_week(&date.into())?;

    for lesson in timetable {
        println!("{:?}", lesson);
    }

    Ok(())
}

I receive the error Error: Rpc(Error { code: -7004, message: "no allowed date" }). Currently there is no active schooljear, but in two weeks there is and data for in two weeks already exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions