
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
A comprehensive Python library for accessing WeatherLink v2 API to retrieve meteorological and air quality data efficiently. Designed for developers, researchers, and weather enthusiasts who need fast, reliable access to weather station data.
pip install weatherlinkv2
Or install from source:
git clone https://github.com/Vendetta0462/weatherlinkv2.git
cd weatherlinkv2
pip install -e .
from weatherlinkv2 import WeatherLinkAPI, parse_weather_data
# Initialize API in demo mode for testing
api = WeatherLinkAPI(api_key="your_api_key", api_secret="your_api_secret", demo_mode=True)
# Get current weather data from demo station
current_data = api.get_current_data()
print(f"Current sensors: {len(current_data.get('sensors', []))}")
# Get historical data (limited to 24 hours in demo mode)
historic_data = api.get_historic_data(hours_back=24)
# Parse data for specific sensor type (e.g., AirLink sensor type 323)
df = parse_weather_data(historic_data, sensor_type=323, data_structure_type=17)
print(f"Retrieved {len(df)} air quality records")
# Initialize API for production use
api = WeatherLinkAPI(api_key="your_api_key", api_secret="your_api_secret", demo_mode=False)
# Get your stations and sensors
stations = api.get_stations()
sensors = api.get_sensors()
my_station_id = stations[0]['station_id_uuid']
# Get specific station information
station_info = api.get_station_info(my_station_id)
print(f"Station: {station_info.get('station_name')}")
# Get sensor information by sensor ID (lsid)
if sensors:
sensor_info = api.get_sensors_info(sensors[0]['lsid'])
print(f"Sensor type: {sensor_info.get('sensor_type')}")
# Get historical data with extended range for production
historic_data = api.get_historic_data(station_id=my_station_id, hours_back=168) # 7 days
# Parse data for weather station (sensor type 23)
df = parse_weather_data(historic_data, sensor_type=23)
print(f"Retrieved {len(df)} weather records")
requests
- HTTP requestspandas
- Data manipulationmatplotlib
- Basic plottingseaborn
- Enhanced visualizationspython-dotenv
- Environment variable management.env
file:WEATHERLINK_API_KEY=your_api_key_here
WEATHERLINK_API_SECRET=your_api_secret_here
from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv('WEATHERLINK_API_KEY')
api_secret = os.getenv('WEATHERLINK_API_SECRET')
api = WeatherLinkAPI(api_key, api_secret)
This library includes two example files to get you started:
examples/basic_usage.py
)Simple and direct example showing core functionality:
examples/sensor_types.py
)Working with different sensor types:
In bash:
# Make sure you have your API credentials
export WEATHERLINK_API_KEY="your_api_key"
export WEATHERLINK_API_SECRET="your_api_secret"
# Run examples
python examples/basic_usage.py
python examples/sensor_types.py
Method | Description | Parameters |
---|---|---|
__init__(api_key, api_secret, demo_mode) | Initialize API client | API credentials, operation mode |
get_stations() | Get available stations | None |
get_station_info(station_id) | Get specific station info | Optional station ID if demo mode is enabled |
get_sensors() | Get all available sensors | None |
get_sensors_info(sensor_id) | Get specific sensor info | Sensor ID (lsid) |
get_current_data(station_id) | Get current weather data | Station ID |
get_historic_data(station_id, hours_back) | Get historical data | Station ID, hours back |
test_connection() | Test API connection | None |
Function | Description | Parameters | Returns |
---|---|---|---|
parse_weather_data(response, sensor_type, data_structure_type) | Parse API response to DataFrame | API response, sensor type, optional structure type | pandas.DataFrame |
get_weather_summary(df) | Generate statistics summary | DataFrame | dict |
create_weather_plots(df) | Create visualization plots | DataFrame | matplotlib.Figure |
export_to_csv(df, filename) | Export data to CSV | DataFrame, filename | str (file path) |
Sensor Type | Description | Data Structure Types |
---|---|---|
323 | AirLink (Air Quality) | 16 (Current), 17 (Archive) |
The library provides both Imperial and Metric units depending on the sensor-structure pair. For a full list of the fields and units returned by the API, please refer to the official WeatherLink v2 API Sensor Catalog.
git checkout -b feature/amazing-feature
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License - see the LICENSE file for details.
For commercial licensing options, please contact the maintainers.
Powered by WeatherLink API 🌤️ | Made with Python 🐍
FAQs
Professional Python library for WeatherLink v2 API integration
We found that weatherlinkv2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.