Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openweather-sdk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openweather-sdk

Package to use openweather api

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Open Weather API SDK

npm i openweathermap-sdk

How use it example

Get weather from several cities

const appid = process.env.API_KEY // appid could be pass as thrid parameter to getAllWeatherBy

const { getAllWeatherBy } = require('./src/index')

const cities = [
  { name: 'Houston', zip: '77056' }
]

getAllWeatherBy('zip', cities)
  .then(data => console.log(JSON.stringify(data)))
  .catch(console.error)

response

[
  {
    "name": "Houston",
    "data": {
      "coord": {
        "lon": -95.47,
        "lat": 29.73
      },
      "weather": [
        {
          "id": 721,
          "main": "Haze",
          "description": "haze",
          "icon": "50d"
        },
        {
          "id": 701,
          "main": "Mist",
          "description": "mist",
          "icon": "50d"
        }
      ],
      "base": "stations",
      "main": {
        "temp": 18.95,
        "pressure": 1020,
        "humidity": 87,
        "temp_min": 17,
        "temp_max": 21.1
      },
      "visibility": 12874,
      "wind": {
        "speed": 4.1,
        "deg": 110
      },
      "clouds": {
        "all": 75
      },
      "dt": 1549056000,
      "sys": {
        "type": 1,
        "id": 4780,
        "message": 0.0037,
        "country": "US",
        "sunrise": 1549026676,
        "sunset": 1549065612
      },
      "id": 420034412,
      "name": "Houston",
      "cod": 200
    }
  }
]

And can be use it with only one

const { parseArgsToType, getWeatherBy } = require('../src/index')
const appid = process.env.API_KEY // appid could be pass as thrid parameter to getAllWeatherBy by default always read API_KEY

getWeatherBy('zip', { zip: 77056, country: 'us' })
  .then(data => console.log(JSON.stringify(data)))
  .catch(console.error)

FAQs

Package last updated on 01 Feb 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc