
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
pygoogleweather
is a Python library to get weather information from Google Search. No API keys required.
pip install pygoogleweather
playwright install chromium
from google_weather.weather import get_weather_sync
# Get weather for a city (returns a dictionary with weather information)
result = get_weather_sync('Buenos Aires')
print(result)
# Output:
# {
# 'temperature': '24.0°C',
# 'humidity': '72%',
# 'wind': '34 km/h',
# 'condition': 'Mostly sunny',
# 'location': 'Buenos Aires, Argentina'
# }
import asyncio
from google_weather.weather import WeatherScraper
async def main():
# Create a scraper instance with custom options
scraper = WeatherScraper(headless=True, debug=False)
try:
# Get weather with custom language and units
result = await scraper.get_weather(
city='Paris',
lang='fr', # French language
temp_unit='F', # Fahrenheit
wind_unit='mph' # Miles per hour
)
print(result)
finally:
# Always close the scraper to free resources
await scraper.close()
# Run the async function
asyncio.run(main())
The library provides a special client for Google Colab that handles all the async complexity for you:
# Install
!pip install pygoogleweather
!playwright install chromium
from google_weather.colab import ColabWeatherClient
# Crear cliente
weather = ColabWeatherClient()
# Buenos Aires
result = weather.get_weather('Buenos Aires', lang='es')
print("\nBuenos Aires (ES):")
print(result)
# Buenos Aires (ES):
# {'location': 'Buenos Aires, Cdad. Autónoma de Buenos Aires, Argentina', 'temperature': '26.7°C', 'condition': 'Parcialmente nublado', 'humidity': '53%', 'wind': '12.0 km/h'}
# New York
result = weather.get_weather('New York', lang='en', temp_unit='F', wind_unit='mph')
print("\nNew York (EN, °F, mph):")
print(result)
# New York (EN, °F, mph):
# {'location': 'New York, NY', 'temperature': '30.0°F', 'condition': 'Partly cloudy', 'humidity': '45%', 'wind': '6.0 mph'}
# Paris
result = weather.get_weather('Paris', lang='fr', temp_unit='C', wind_unit='kmh')
print("\nParis (FR, °C, kmh):")
print(result)
# Paris (FR, °C, kmh):
# {'location': 'Paris, France', 'temperature': '3.9°C', 'condition': 'Nuageux', 'humidity': '93%', 'wind': '12.0 km/h'}
You can enable debug mode to save screenshots during scraping:
scraper = WeatherScraper(debug=True) # Screenshots will be saved in 'debug_screenshots' directory
The WeatherScraper
class accepts these parameters:
headless
(bool): Run browser in headless mode (default: True)debug
(bool): Enable debug mode with screenshots (default: False)The get_weather
method accepts:
city
(str): City namelang
(str): Language code (default: 'en')temp_unit
(str): Temperature unit ('C', 'F', or 'K', default: 'C')wind_unit
(str): Wind speed unit ('kmh' or 'mph', default: 'kmh')playwright install
)This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Python library to get weather from Google Search. No API keys required.
We found that pygoogleweather 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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.