wspr_cdk makes it easy to access and analyze WSPR (Weak Signal Propagation Reporter) real-time spot data from the WSPR database.
Ensure the service_account.json file is correctly set up for Google Drive API authentication. If missing or misconfigured, you will encounter authentication errors.
-
Create a Service Account:
- Go to the Google Cloud Console.
- Navigate to IAM & Admin > Service Accounts.
- Click "Create Service Account", fill out the details, and click "Create".
-
Generate a JSON Key:
- Click on the created service account.
- Go to the "Keys" tab.
- Click "Add Key" > "Create new key" > JSON. This downloads a JSON file with your credentials.
-
Provide Permissions:
- Assign the necessary roles to the service account for Google Drive access.
-
Configure Environment:
- Place
service_account.jsonin an accessible location for your application. - If using Docker, mount
service_account.jsoninto the container at runtime.
- Place
To run wspr_cdk in a Development Container, use Docker. Mount the service_account.json file securely to provide credentials at runtime:
`sudo docker run -it -p 8000:8000 -e GOOGLE_APPLICATION_CREDENTIALS=/wspr_cdk/service_account.json -v ./service_account.json:/wspr_cdk/service_account.json wspr_cdk python ./hyper/hyper/server.py --interval 10 --num_rows 10- Fetch WSPR spot data in formats: JSON, JSONCompact, JSONEachRow
- Integrate with Tokio for asynchronous operations
- Manage session state and dispatch actions to the ClickHouse client
- Server component for sharing real-time data via HTTP
- Mutual TLS for secure communications
- SSL (OpenSSL) support for encrypted data transfer
Add wspr_cdk to your Cargo.toml:
[dependencies]
wspr_cdk = "0.0.12"Set the environment variable:
export BASE_URL=http://db1.wspr.live/Run the Python server:
docker run -it wspr_cdk python ./hyper/hyper/server.py --interval 5 --num_rows 5Run the Rust server:
docker run -e ROCKET_ADDRESS=0.0.0.0 -e ROCKET_PORT=8000 -it wspr_cdk rustuse chrono::NaiveDateTime;
use wspr::{services::prelude::*, state::prelude::*};
#[tokio::main]
async fn main() {
let mut state = ClickHouseClient::init();
let session = session_manager::SessionManager::new();
ClickHouseClient::dispatch(&mut state, ClickHouseAction::Get, "10", "JSON").await;
println!("\n{:#?}\n", state);
ClickHouseClient::dispatch(&mut state, ClickHouseAction::GetById(1));
println!("\n[OUTPUT]: {:?}", state);
let json_response = serde_json::to_string_pretty(&response).unwrap();
println!("{}", json_response);
}wget -q -O - "http://db1.wspr.live/?query=SELECT * FROM wspr.rx LIMIT 5 FORMAT JSON;"Fetching all records...
ClickHouseState {
DATA: [
WsprSpot {
id: 7766261671,
time: 2024-05-29T17:30:00,
band: -1,
rx_sign: "F6CWA",
rx_lat: 48.021,
rx_lon: -4.125,
rx_loc: "IN78wa",
tx_sign: "DL7NN",
...
},
],
STATUS: "Fetching all records.",
}Access and share real-time WSPR data via HTTP. Example cURL request:
curl -X GET http://localhost:8000/api/spotsFetch WSPR data using client-side JavaScript:
<!doctype html>
<html>
<head>
<title>WSPR Spots</title>
</head>
<body>
<div id="demo"></div>
<script> const content = document.getElementById("demo");
async function getData() {
let response = await fetch("http://localhost:8000/api/spots");
let raw = await response.json();
for (let i of raw) {
console.log(i);
content.innerHTML += `
<h2>Spot id: ${i.id}</h2>
<p>Time: ${i.time}</p>
<p>Band: ${i.band}</p>
`;
}
}
getData(); </script>
</body>
</html>Disclaimer: The dataset may contain duplicates, false spots, and other errors. Use the services provided on wspr.live for non-commercial, free research projects. No guarantees on the correctness, availability, or stability of these services.
This project is licensed under the BSD License. See the LICENSE file for details.
Contributions are welcome! Please submit issues or pull requests. Ensure compliance with the licensing and guidelines.
Special thanks to the WSPR community for data access and infrastructure maintenance.
The wspr_cdk is available on Docker Hub:
docker pull lexaraprime/wspr_cdk:masterDocumentation is also available on crates.io.