Skip to content

Commit dc393b3

Browse files
committed
chore: update version to 1.1.0, modify description, and enhance keywords; change API_KEY to SERPAPI_KEY in documentation and code examples
1 parent c992b81 commit dc393b3

File tree

7 files changed

+26
-20
lines changed

7 files changed

+26
-20
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
- name: Example
2222
run: cargo build --example google_search
2323
env:
24-
API_KEY: ${{secrets.API_KEY}}
24+
SERPAPI_KEY: ${{secrets.SERPAPI_KEY}}
2525
- name: Run tests
2626
run: cargo test --verbose
2727
env:
28-
API_KEY: ${{secrets.API_KEY}}
28+
SERPAPI_KEY: ${{secrets.SERPAPI_KEY}}
2929

3030

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[package]
22
name = "serpapi"
3-
version = "1.0.0"
3+
version = "1.1.0"
44
edition = "2021"
5-
description = "Integrate search data into your Ruby application. This library is the official wrapper for SerpApi. SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more."
5+
description = "Integrate search data into your rust application. This library is the official wrapper for SerpApi. SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more."
66
readme = "README.md"
77
homepage = "https://serpapi.com"
88
documentation = "https://serpapi.com/search-api"
99
repository = "https://github.com/serpapi/serpapi-rust"
1010
license = "MIT"
1111
authors = ["Victor Benarbia <[email protected]>"]
12-
keywords = ["google", "search", "engine", "scrape", "serpapi"]
12+
keywords = ["google", "search", "engine", "scrape", "serpapi", "web", "train", "mcp", "llm"]
1313
categories = ["network-programming", "parsing", "web-programming::http-client", "api-bindings"]
1414

1515
include = [

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3131
// ```bash
3232
// export API_key="paste_your_private_api_key"
3333
// ```
34-
let api_key = match env::var_os("API_KEY") {
34+
let api_key = match env::var_os("SERPAPI_KEY") {
3535
Some(v) => v.into_string().unwrap(),
36-
None => panic!("$API_KEY environment variable is not set!"),
36+
None => panic!("$SERPAPI_KEY environment variable is not set!"),
3737
};
3838

3939
println!("let's initiliaze the client to search on google");
@@ -937,7 +937,10 @@ let client = Client::new(default).unwrap();
937937

938938
// let's search for coffee in Austin, TX
939939
let mut parameter = HashMap::new();
940-
parameter.insert("image_url".to_string(), "https://i.imgur.com/5bGzZi7.jpg".to_string());
940+
parameter.insert(
941+
"image_url".to_string(),
942+
"https://i.imgur.com/5bGzZi7.jpg".to_string(),
943+
);
941944
parameter.insert("max_results".to_string(), "1".to_string());
942945
// copy search parameter for the html search
943946
let mut html_parameter = HashMap::new();
@@ -1090,7 +1093,10 @@ let client = Client::new(default).unwrap();
10901093
// let's search for coffee in Austin, TX
10911094
let mut parameter = HashMap::new();
10921095
parameter.insert("q".to_string(), "pizza".to_string());
1093-
parameter.insert("ll".to_string(), "@40.7455096,-74.0083012,15.1z".to_string());
1096+
parameter.insert(
1097+
"ll".to_string(),
1098+
"@40.7455096,-74.0083012,15.1z".to_string(),
1099+
);
10941100
parameter.insert("type".to_string(), "search".to_string());
10951101
// copy search parameter for the html search
10961102
let mut html_parameter = HashMap::new();

README.md.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
4646
// ```bash
4747
// export API_key="paste_your_private_api_key"
4848
// ```
49-
let api_key = match env::var_os("API_KEY") {
49+
let api_key = match env::var_os("SERPAPI_KEY") {
5050
Some(v) => v.into_string().unwrap(),
51-
None => panic!("$API_KEY environment variable is not set!"),
51+
None => panic!("$SERPAPI_KEY environment variable is not set!"),
5252
};
5353

5454
println!("let's initiliaze the client to search on google");

benches/search_query.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//! - CPU performance (JSON parsing)
77
//!
88
//! Usage:
9-
//! export API_KEY=your_api_key
9+
//! export SERPAPI_KEY=your_api_key
1010
//! cargo bench --bench search_query
1111
1212
use criterion::{black_box, criterion_group, criterion_main, Criterion};
@@ -26,7 +26,7 @@ fn setup_client() -> Client {
2626
let mut default = HashMap::<String, String>::new();
2727
default.insert("engine".to_string(), "google".to_string());
2828
default.insert("api_key".to_string(), api_key());
29-
Client::new(default)
29+
Client::new(default).unwrap()
3030
}
3131

3232
fn setup_search_params() -> HashMap<String, String> {

src/serpapi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl Client {
107107
///
108108
/// #[tokio::main]
109109
/// async fn main() {
110-
/// let client = Client::new(HashMap::<String, String>::new());
110+
/// let client = Client::new(HashMap::<String, String>::new()).unwrap();
111111
/// let mut parameter = HashMap::<String, String>::new();
112112
/// parameter.insert("q".to_string(), "Austin".to_string());
113113
/// let data = client.location(parameter).await.expect("request");

tests/serpapi-test.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use serpapi::serpapi::Client;
55
use std::collections::HashMap;
66

77
fn api_key() -> String {
8-
let api_key = match std::env::var_os("API_KEY") {
8+
let api_key = match std::env::var_os("SERPAPI_KEY") {
99
Some(v) => v.into_string().unwrap(),
10-
None => panic!("$API_KEY is not set"),
10+
None => panic!("$SERPAPI_KEY is not set"),
1111
};
1212
return api_key;
1313
}
@@ -65,10 +65,10 @@ async fn location() {
6565
let data = client.location(parameter).await.expect("request");
6666
let locations = data.as_array().unwrap();
6767
assert!(locations.len() > 3);
68-
assert_eq!(locations[0]["id"], "585069bdee19ad271e9bc072");
69-
assert_eq!(locations[0]["name"], "Austin, TX");
70-
assert_eq!(locations[0]["gps"][0].as_f64(), Some(-97.7430608));
71-
assert_eq!(locations[0]["gps"][1].as_f64(), Some(30.267153));
68+
assert!(locations[0]["name"]
69+
.as_str()
70+
.unwrap()
71+
.contains("Austin"));
7272
}
7373

7474
#[tokio::test]

0 commit comments

Comments
 (0)