From ccb582a8b7152b063a787c3e7bd28087a1c374b1 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sun, 12 May 2024 06:38:08 +0300 Subject: [PATCH] fix rust examples --- Cargo.toml | 8 +++++++- examples/rust/http/Cargo.toml | 3 +-- examples/rust/http/src/main.rs | 4 ++-- examples/rust/logging/Cargo.toml | 3 +-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7c20ca8..dada637 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,10 @@ [workspace] -members = ["rookie-rs", "bindings/python", "bindings/node", "cli"] +members = [ + "rookie-rs", + "bindings/python", + "bindings/node", + "cli", + "examples/rust/*", +] default-members = ["rookie-rs", "bindings/python"] resolver = "2" diff --git a/examples/rust/http/Cargo.toml b/examples/rust/http/Cargo.toml index c3bf7c1..7b33bcc 100644 --- a/examples/rust/http/Cargo.toml +++ b/examples/rust/http/Cargo.toml @@ -9,5 +9,4 @@ edition = "2021" [dependencies] regex = "1.9.5" reqwest = { version = "0.11.20", features = ["blocking"] } -rookie = { path = "../../", version = "*" } - +rookie = { path = "../../../rookie-rs" } diff --git a/examples/rust/http/src/main.rs b/examples/rust/http/src/main.rs index 8a30266..c5a5865 100644 --- a/examples/rust/http/src/main.rs +++ b/examples/rust/http/src/main.rs @@ -1,6 +1,6 @@ use regex::Regex; use reqwest::blocking::Client; -use rookie::{common::enums::CookieToString, firefox}; +use rookie::{common::enums::CookieToString, load}; fn extract_username(html: &str) -> &str { let re = Regex::new(r#"dashboard\/ajax_context_list\?current_context=(.+)""#).unwrap(); @@ -15,7 +15,7 @@ fn extract_username(html: &str) -> &str { fn main() -> Result<(), Box> { // Create a custom cookie store let client = Client::new(); - let cookies = firefox(Some(vec!["github.com"]))?; + let cookies = load(Some(vec!["github.com".into()]))?; let response = client.get("https://github.com/") .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36") .header("Cookie", cookies.to_string()) // <- try to comment diff --git a/examples/rust/logging/Cargo.toml b/examples/rust/logging/Cargo.toml index 9200b2d..9f88688 100644 --- a/examples/rust/logging/Cargo.toml +++ b/examples/rust/logging/Cargo.toml @@ -7,5 +7,4 @@ edition = "2021" [dependencies] pretty_env_logger = "0.5.0" -rookie = { path = "../../", version = "*" } - +rookie = { path = "../../../rookie-rs" }