Skip to content

Commit

Permalink
fix rust examples
Browse files Browse the repository at this point in the history
  • Loading branch information
thewh1teagle committed May 12, 2024
1 parent 0995543 commit ccb582a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 1 addition & 2 deletions examples/rust/http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
4 changes: 2 additions & 2 deletions examples/rust/http/src/main.rs
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -15,7 +15,7 @@ fn extract_username(html: &str) -> &str {
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 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
Expand Down
3 changes: 1 addition & 2 deletions examples/rust/logging/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ edition = "2021"

[dependencies]
pretty_env_logger = "0.5.0"
rookie = { path = "../../", version = "*" }

rookie = { path = "../../../rookie-rs" }

0 comments on commit ccb582a

Please sign in to comment.