dscottboggs / mastodon-async

Mastodon Client for Rust
Other
34 stars 12 forks source link

search_accounts got a RelativeUrlWithoutBase error #108

Closed Tyketc closed 1 year ago

Tyketc commented 1 year ago

Version

v1.2.2

Error log

mastodon_async::mastodon making API request
    url /api/v1/accounts/search?q=test&following=false
    method get
    call_id b3623b8d-357d-456d-82bd-661973127a97
Error: Http(reqwest::Error { kind: Builder, source: RelativeUrlWithoutBase })

Test Code

use futures_util::StreamExt;
use mastodon_async::prelude::*;
use mastodon_async::mastodon::Mastodon;
use mastodon_async::helpers::toml;
use mastodon_async::{helpers::cli, Result};
use mastodon_async::entities::account::Account;

#[tokio::main]
async fn main() -> Result<()> {
    femme::with_level(log::LevelFilter::Trace);
    let mastodon = if let Ok(data) = toml::from_file("settings.toml") {
        Mastodon::from(data)
    } else {
        register().await?
    };
    let base_url = &mastodon.data.base;
    let me = mastodon.verify_credentials().await?;

    let result = mastodon.search_accounts("test", None, false).await?;
    for account in result.initial_items {
        println!("{} {}", account.acct, account.id);
    }

    Ok(())
}
dscottboggs commented 1 year ago

Thanks for bringing this to my attention.