TheWeatherAPI v2!!
A package to retrieve weather data from https://www.weatherapi.com/.
It is easy to use, and it covers 10% of the API, Current Weather only for now (100% Coming Soon™).
Now v2! Introducing the Forecast API; get the forecast of a location for up to 6 days!
Features
- Current Weather API
- Forecast Weather API
Examples
How to get easily access the Current Weather:
const { WeatherClient } = require('theweatherapi');
const client = new WeatherClient({
apiKey: 'some_api_key',
language: 'FRENCH',
defaultLocation: 'Paris'
});
client.on('ready', async () => {
const weatherInfo = client.current.weather;
const weatherLocation = client.current.location;
console.log(`Current Weather of ${client.defaultLocation}:`, weatherInfo);
console.log(`Current Weather Location of ${client.defaultLocation}:`, weatherLocation);
const { weather, location, aqi } = await client.current.get('London', true);
console.log(weather, location, aqi);
});
How can I access the APIs that are not implemented using theweatherapi?
You can use non-implemented APIs using the REST module like this:
Note: You will have to know which params to use for the API or refer to api-types.json
const { BaseWeatherClient } = require('theweatherapi');
const baseClient = new BaseWeatherClient();
const response = await client.api.search.get({key: 'somekey', q: 'Paris'});
console.log(response);
Roadmap
Documentation
Visit this page. (Coming Soon™)
Powered by WeatherAPI.com